on master help sign in
Don't track exactly the part that is mismatched
1038b75Evan Czaplicki
src/Type/Unify.hs+11−14
@@ -24,7 +24,7 @@ unify hint region expected actual =
24 Right state ->
24 Right state ->
25 return state
25 return state
26
26
27− Left (Mismatch _subExpected _subActual maybeReason) ->
27+ Left (Mismatch maybeReason) ->
28 let
28 let
29 mkError =
29 mkError =
30 do expectedSrcType <- Type.toSrcType expected
30 do expectedSrcType <- Type.toSrcType expected
@@ -71,22 +71,19 @@ reorient (Context orientation var1 desc1 var2 desc2) =
71-- ERROR MESSAGES
71-- ERROR MESSAGES
72
72
73
73
74−data Mismatch
74+newtype Mismatch =
75− = Mismatch Variable Variable (Maybe Error.Reason)
75+ Mismatch (Maybe Error.Reason)
76
76
77
77
78mismatch :: Context -> Maybe Error.Reason -> Unify a
78mismatch :: Context -> Maybe Error.Reason -> Unify a
79−mismatch (Context orientation first _ second _) maybeReason =
79+mismatch (Context orientation _ _ _ _) maybeReason =
80− let
80+ throwError $ Mismatch $
81− (expected, actual, orientedReason) =
82− case orientation of
81+ case orientation of
83− ExpectedActual ->
82+ ExpectedActual ->
84− (first, second, maybeReason)
83+ maybeReason
85−
84+
86− ActualExpected ->
85+ ActualExpected ->
87− (second, first, Error.flipReason <$> maybeReason)
86+ Error.flipReason <$> maybeReason
88− in
89− throwError (Mismatch expected actual orientedReason)
90
87
91
88
92badRigid :: Maybe String -> Error.Reason
89badRigid :: Maybe String -> Error.Reason