@@ -14,8 +14,6 @@ import Types.Types
14import Types.Constrain
14import Types.Constrain
15import Types.Substitutions
15import Types.Substitutions
17−import System.IO.Unsafe
19isSolved ss (C _ _ (t1 :=: t2)) = t1 == t2
17isSolved ss (C _ _ (t1 :=: t2)) = t1 == t2
20isSolved ss (C _ _ (x :<<: _)) = isJust (lookup x ss)
18isSolved ss (C _ _ (x :<<: _)) = isJust (lookup x ss)
21isSolved ss c = False
19isSolved ss c = False
@@ -54,10 +52,8 @@ schemeSub' x s c@(C txt span constraint) =
54 c' = y :<<: Forall (cxs ++ xs) constraints (subst ss ctipe)
52 c' = y :<<: Forall (cxs ++ xs) constraints (subst ss ctipe)
55 return [ C txt span c' ]
53 return [ C txt span c' ]
57−p x = unsafePerformIO (print x) `seq` x
59recordConstraints eq fs t fs' t' =
55recordConstraints eq fs t fs' t' =
60− liftM (p . concat) . sequence $
56+ liftM concat . sequence $
61 [ constrain fs fs'
57 [ constrain fs fs'
62 , liftM concat . mapM (\(k,ts) -> zipper [] k ts []) . Map.toList $
58 , liftM concat . mapM (\(k,ts) -> zipper [] k ts []) . Map.toList $
63 Map.difference fs fs'
59 Map.difference fs fs'
@@ -76,10 +72,10 @@ recordConstraints eq fs t fs' t' =
76 ([],[]) -> return cs
72 ([],[]) -> return cs
77 (as,[]) -> do x <- guid
73 (as,[]) -> do x <- guid
78 let tipe = RecordT (Map.singleton k as) (VarT x)
74 let tipe = RecordT (Map.singleton k as) (VarT x)
79− return . p $ (cs ++ [eq t' tipe])
75+ return (cs ++ [eq t' tipe])
80 ([],bs) -> do x <- guid
76 ([],bs) -> do x <- guid
81 let tipe = RecordT (Map.singleton k bs) (VarT x)
77 let tipe = RecordT (Map.singleton k bs) (VarT x)
82− return . p $ (cs ++ [eq t tipe])
78+ return (cs ++ [eq t tipe])
84solver :: [Context Constraint]
80solver :: [Context Constraint]
85 -> Map.Map X Type
81 -> Map.Map X Type
@@ -98,7 +94,6 @@ solver (C txt span c : cs) subs =
98 solver ([ eq t1 t1', eq t2 t2' ] ++ cs) subs
94 solver ([ eq t1 t1', eq t2 t2' ] ++ cs) subs
100 RecordT fs t :=: RecordT fs' t' ->
96 RecordT fs t :=: RecordT fs' t' ->
101− unsafePerformIO (print c) `seq`
102 do cs' <- recordConstraints eq fs t fs' t'
97 do cs' <- recordConstraints eq fs t fs' t'
103 solver (cs' ++ cs) subs
98 solver (cs' ++ cs) subs