type IsString + test unification error

This commit is contained in:
crumbtoo
2023-12-18 11:22:40 -07:00
parent 0470912983
commit e9e1c075db
3 changed files with 16 additions and 4 deletions

View File

@@ -7,6 +7,7 @@ module Core.HindleyMilner
( infer
, Context'
, TypeError(..)
, HMError
)
where
----------------------------------------------------------------------------------
@@ -50,7 +51,7 @@ type HMError = Either TypeError
-- >>> infer g2 [coreExpr|id 3|]
-- Left (TyErrCouldNotUnify (TyVar "a" :-> TyVar "a") TyInt)
infer :: Context' -> Expr' -> Either TypeError Type
infer :: Context' -> Expr' -> HMError Type
infer g e = do
(t,cs) <- gather g e
foldr (uncurry subst) t <$> unify cs