@@ -44,7 +44,10 @@ instance Show FC where
4444
4545data Err = Msg String
4646 | InternalMsg String
47− | CantUnify Term Term Err [(Name, Type)] Int -- Int is 'score' - how much we did unify
47+ | CantUnify Bool Term Term Err [(Name, Type)] Int
48+ -- Int is 'score' - how much we did unify
49+ -- Bool indicates recoverability, True indicates more info may make
50+ -- unification succeed
4851 | NoSuchVariable Name
4952 | NotInjective Term Term Term
5053 | CantResolve Term
@@ -59,7 +62,7 @@ data Err = Msg String
5962instance Sized Err where
6063 size (Msg msg) = length msg
6164 size (InternalMsg msg) = length msg
62− size (CantUnify left right err _ score) = size left + size right + size err
65+ size (CantUnify _ left right err _ score) = size left + size right + size err
6366 size (NoSuchVariable name) = size name
6467 size (NotInjective l c r) = size l + size c + size r
6568 size (CantResolve trm) = size trm
@@ -71,7 +74,7 @@ instance Sized Err where
7174 size (Inaccessible _) = 1
7275
7376score :: Err -> Int
74−score (CantUnify _ _ m _ s) = s + score m
77+score (CantUnify _ _ _ m _ s) = s + score m
7578score (CantResolve _) = 20
7679score (NoSuchVariable _) = 1000
7780score _ = 0
@@ -79,14 +82,14 @@ score _ = 0
7982instance Show Err where
8083 show (Msg s) = s
8184 show (InternalMsg s) = "Internal error: " ++ show s
82− show (CantUnify l r e sc i) = "CantUnify " ++ show l ++ " " ++ show r ++ " "
83− ++ show e ++ " in " ++ show sc ++ " " ++ show i
85+ show (CantUnify _ l r e sc i) = "CantUnify " ++ show l ++ " " ++ show r ++ " "
86+ ++ show e ++ " in " ++ show sc ++ " " ++ show i
8487 show (Inaccessible n) = show n ++ " is not an accessible pattern variable"
8588 show _ = "Error"
8689
8790instance Pretty Err where
8891 pretty (Msg m) = text m
89− pretty (CantUnify l r e _ i) =
92+ pretty (CantUnify _ l r e _ i) =
9093 if size l + size r > breakingSize then
9194 text "Cannot unify" <+> colon $$
9295 nest nestingSize (pretty l <+> text "and" <+> pretty r) $$