Skip to content

Commit

Permalink
fixed occurs check and test-0
Browse files Browse the repository at this point in the history
  • Loading branch information
mbuszka committed Jan 27, 2018
1 parent 25bf838 commit df0d83d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/Inference/Solve.hs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ unifyR s (r1@(Row l1 v1), r2@(Row l2 v2)) = let

(Just a, Just b) -> do
fr <- fresh
when (a == b && l1 /= l2) $ throw $ UnificationError $ "recursive types:" <+> pretty r1 <+> "and" <+> pretty r2
when (a == b && (List.sort l1) /= (List.sort l2)) $
throw $ UnificationError $
"recursive types:" <+> pretty r1 <+> "and" <+> pretty r2
s' <- Subst.extend a (Right $ Row extraInL2 (Just fr)) s >>=
Subst.extend b (Right $ Row extraInL1 (Just fr))
-- liftIO $ putDocW 80 $ "resulting subst:" P.<+> pretty s' P.<> P.line
Expand Down
2 changes: 1 addition & 1 deletion src/Syntax/Parse.hs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ term = Let <$> (res "let" *> ident) <*> (resOp "=" *> term) <*> (res "in" *
<|> LetRec <$> (res "letrec" *> ident) <*> ident <*> (resOp "->" *> term) <*> (res "in" *> term)
<|> Abs <$> (res "fn" *> ident) <*> (resOp "->" *> term)
<|> Handle <$> (res "handle" *> tyLit) <*> (res "in" *> term) <*> (res "with" *> handlers)
<|> Lift <$> (res "lift" *> tyLit) <*> (res "in" *> term2)
<|> Lift <$> (res "lift" *> tyLit) <*> (res "in" *> parens term)
<|> Cond <$> (res "if" *> term) <*> (res "then" *> term) <*> (res "else" *> term <* res "end")
<|> Bind <$> (P.try (ident <* resOp "<-")) <*> term <*> (resOp "," *> term)
<|> term1
Expand Down
2 changes: 1 addition & 1 deletion test/test-0.al
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ let runState = fn s -> fn c ->
c ()
with
tell x, r ->
(handle RD in
lift RD in (handle RD in
r ()
with
ask u, r -> r x;
Expand Down

0 comments on commit df0d83d

Please sign in to comment.