@@ -43,7 +43,7 @@ instance Show FC where
43 show (FC f l) = f ++ ":" ++ show l
43 show (FC f l) = f ++ ":" ++ show l
45data Err = Msg String
45data Err = Msg String
46− | CantUnify Term Term Err Int -- Int is 'score' - how much we did unify
46+ | CantUnify Term Term Err [(Name, Type)] Int -- Int is 'score' - how much we did unify
47 | NoSuchVariable Name
47 | NoSuchVariable Name
48 | NotInjective Term Term Term
48 | NotInjective Term Term Term
49 | CantResolve Term
49 | CantResolve Term
@@ -56,7 +56,7 @@ data Err = Msg String
57instance Sized Err where
57instance Sized Err where
58 size (Msg msg) = length msg
58 size (Msg msg) = length msg
59− size (CantUnify left right err score) = size left + size right + size err
59+ size (CantUnify left right err _ score) = size left + size right + size err
60 size (NoSuchVariable name) = size name
60 size (NoSuchVariable name) = size name
61 size (NotInjective l c r) = size l + size c + size r
61 size (NotInjective l c r) = size l + size c + size r
62 size (CantResolve trm) = size trm
62 size (CantResolve trm) = size trm
@@ -67,21 +67,21 @@ instance Sized Err where
67 size (Inaccessible _) = 1
67 size (Inaccessible _) = 1
69score :: Err -> Int
69score :: Err -> Int
70−score (CantUnify _ _ m s) = s + score m
70+score (CantUnify _ _ m _ s) = s + score m
71score (CantResolve _) = 20
71score (CantResolve _) = 20
72score (NoSuchVariable _) = 1000
72score (NoSuchVariable _) = 1000
73score _ = 0
73score _ = 0
75instance Show Err where
75instance Show Err where
76 show (Msg s) = s
76 show (Msg s) = s
77− show (CantUnify l r e i) = "CantUnify " ++ show l ++ " " ++ show r ++ " "
77+ show (CantUnify l r e sc i) = "CantUnify " ++ show l ++ " " ++ show r ++ " "
78− ++ show e ++ " " ++ show i
78+ ++ show e ++ " in " ++ show sc ++ " " ++ show i
79 show (Inaccessible n) = show n ++ " is not an accessible pattern variable"
79 show (Inaccessible n) = show n ++ " is not an accessible pattern variable"
80 show _ = "Error"
80 show _ = "Error"
82instance Pretty Err where
82instance Pretty Err where
83 pretty (Msg m) = text m
83 pretty (Msg m) = text m
84− pretty (CantUnify l r e i) =
84+ pretty (CantUnify l r e _ i) =
85 if size l + size r > breakingSize then
85 if size l + size r > breakingSize then
86 text "Cannot unify" <+> colon $$
86 text "Cannot unify" <+> colon $$
87 nest nestingSize (pretty l <+> text "and" <+> pretty r) $$
87 nest nestingSize (pretty l <+> text "and" <+> pretty r) $$