From 3d45e12676f09c58912ca0389326501b97f13e43 Mon Sep 17 00:00:00 2001 From: crumbtoo Date: Tue, 23 Jan 2024 21:08:17 -0700 Subject: [PATCH] infer letrec expressions --- src/Core/HindleyMilner.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Core/HindleyMilner.hs b/src/Core/HindleyMilner.hs index 6d9bfe9..3699310 100644 --- a/src/Core/HindleyMilner.hs +++ b/src/Core/HindleyMilner.hs @@ -158,7 +158,7 @@ gather = \g e -> runStateT (go g e) ([],0) <&> \ (t,(cs,_)) -> (t,cs) where g' <- buildLetrecContext g bs go g' e - -- TODO letrec, lambda, case + -- TODO lambda, case buildLetrecContext :: Context' -> [Binding'] -> StateT ([Constraint], Int) HMError Context' @@ -258,6 +258,9 @@ demoContext :: Context' demoContext = [ ("fix", (TyVar "a" :-> TyVar "a") :-> TyVar "a") , ("add", TyInt :-> TyInt :-> TyInt) + , ("==", TyInt :-> TyInt :-> TyCon "Bool") + , ("True", TyCon "Bool") + , ("False", TyCon "Bool") ] pprintType :: Type -> String