Properly quantify variables in Data expressions.
This commit is contained in:
parent
585107eaed
commit
a736a28a43
1 changed files with 3 additions and 5 deletions
|
@ -86,13 +86,11 @@ constrain env (L span expr) tipe =
|
||||||
and . (:) ce <$> mapM branch branches
|
and . (:) ce <$> mapM branch branches
|
||||||
|
|
||||||
Data name exprs ->
|
Data name exprs ->
|
||||||
do pairs <- mapM pair exprs
|
do vars <- forM exprs $ \_ -> var Flexible
|
||||||
|
let pairs = zip exprs (map VarN vars)
|
||||||
(ctipe, cs) <- Monad.foldM step (tipe,true) (reverse pairs)
|
(ctipe, cs) <- Monad.foldM step (tipe,true) (reverse pairs)
|
||||||
return (cs /\ name <? ctipe)
|
return $ ex vars (cs /\ name <? ctipe)
|
||||||
where
|
where
|
||||||
pair e = do v <- var Flexible -- needs an ex
|
|
||||||
return (e, VarN v)
|
|
||||||
|
|
||||||
step (t,c) (e,x) = do
|
step (t,c) (e,x) = do
|
||||||
c' <- constrain env e x
|
c' <- constrain env e x
|
||||||
return (x ==> t, c /\ c')
|
return (x ==> t, c /\ c')
|
||||||
|
|
Loading…
Reference in a new issue