1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 10:15:55 +03:00

Unify sums.

This commit is contained in:
Rob Rix 2018-05-11 10:49:12 -04:00
parent 7ca6fd736e
commit a755d14188

View File

@ -83,6 +83,7 @@ unify Null b = pure b
unify (Var _) b = pure b
unify a (Var _) = pure a
unify (Array t1) (Array t2) = Array <$> unify t1 t2
unify (a1 :+ b1) (a2 :+ b2) = (:+) <$> unify a1 a2 <*> unify b1 b2
unify (a1 :* b1) (a2 :* b2) = (:*) <$> unify a1 a2 <*> unify b1 b2
unify t1 t2
| t1 == t2 = pure t2