projekty
/
fp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
94f9e5a
)
fix bug in unification
author
Tomáš Musil
<tomik.musil@gmail.com>
Sun, 6 Sep 2015 16:28:10 +0000
(18:28 +0200)
committer
Tomáš Musil
<tomik.musil@gmail.com>
Sun, 6 Sep 2015 16:28:10 +0000
(18:28 +0200)
src/HM.hs
patch
|
blob
|
history
diff --git
a/src/HM.hs
b/src/HM.hs
index
e643938
..
9591706
100644
(file)
--- a/
src/HM.hs
+++ b/
src/HM.hs
@@
-86,7
+86,7
@@
unify (TypeVar a) t = varBind a t
unify t (TypeVar a) = varBind a t
unify (TypeFunction a b) (TypeFunction a' b') = do
s1 <- unify a a'
unify t (TypeVar a) = varBind a t
unify (TypeFunction a b) (TypeFunction a' b') = do
s1 <- unify a a'
- s2 <- unify
b b'
+ s2 <- unify
(substituteT s1 b) (substituteT s1 b')
return $ s1 `composeSub` s2
unify (Primitive a) (Primitive b) | a == b = return idSub
unify a b = fail $ "cannot unify " ++ show a ++ " with " ++ show b
return $ s1 `composeSub` s2
unify (Primitive a) (Primitive b) | a == b = return idSub
unify a b = fail $ "cannot unify " ++ show a ++ " with " ++ show b
@@
-127,7
+127,6
@@
ti e (NTTerm (Let x a b)) = do
e' = Map.insert x t' e
(s2, t2) <- ti (Map.map (substituteS s1) e') b
return (s1 `composeSub` s2, t2)
e' = Map.insert x t' e
(s2, t2) <- ti (Map.map (substituteS s1) e') b
return (s1 `composeSub` s2, t2)
-
algW :: TypedTerm -> Either String Type
algW t = fst . runTI $ do
algW :: TypedTerm -> Either String Type
algW t = fst . runTI $ do