infer letrec expressions

This commit is contained in:
crumbtoo
2024-01-23 21:08:17 -07:00
parent 22b5b47795
commit 3d45e12676

View File

@@ -158,7 +158,7 @@ gather = \g e -> runStateT (go g e) ([],0) <&> \ (t,(cs,_)) -> (t,cs) where
g' <- buildLetrecContext g bs g' <- buildLetrecContext g bs
go g' e go g' e
-- TODO letrec, lambda, case -- TODO lambda, case
buildLetrecContext :: Context' -> [Binding'] buildLetrecContext :: Context' -> [Binding']
-> StateT ([Constraint], Int) HMError Context' -> StateT ([Constraint], Int) HMError Context'
@@ -258,6 +258,9 @@ demoContext :: Context'
demoContext = demoContext =
[ ("fix", (TyVar "a" :-> TyVar "a") :-> TyVar "a") [ ("fix", (TyVar "a" :-> TyVar "a") :-> TyVar "a")
, ("add", TyInt :-> TyInt :-> TyInt) , ("add", TyInt :-> TyInt :-> TyInt)
, ("==", TyInt :-> TyInt :-> TyCon "Bool")
, ("True", TyCon "Bool")
, ("False", TyCon "Bool")
] ]
pprintType :: Type -> String pprintType :: Type -> String