1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 14:21:31 +03:00

Note a bug in unify.

This commit is contained in:
Rob Rix 2017-12-20 17:26:37 -05:00
parent 9aa0ae2f32
commit 7802356d85

View File

@ -30,5 +30,6 @@ unify (a1 :-> b1) (a2 :-> b2) = (:->) <$> unify a1 a2 <*> unify b1 b2
unify (a1 :* b1) (a2 :* b2) = (:*) <$> unify a1 a2 <*> unify b1 b2 unify (a1 :* b1) (a2 :* b2) = (:*) <$> unify a1 a2 <*> unify b1 b2
unify (TVar _) b = pure b unify (TVar _) b = pure b
unify a (TVar _) = pure a unify a (TVar _) = pure a
-- FIXME: this can succeed incorrectly for lists of inequal length.
unify (TArr as) (TArr bs) = TArr <$> for (zip as bs) (uncurry unify) unify (TArr as) (TArr bs) = TArr <$> for (zip as bs) (uncurry unify)
unify t1 t2 = fail ("cannot unify " ++ show t1 ++ " with " ++ show t2) unify t1 t2 = fail ("cannot unify " ++ show t1 ++ " with " ++ show t2)