@@ -24,7 +24,7 @@ unify hint region expected actual =
24 Right state ->
24 Right state ->
25 return state
25 return state
27− Left (Mismatch _subExpected _subActual maybeReason) ->
27+ Left (Mismatch maybeReason) ->
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
74−data Mismatch
74+newtype Mismatch =
75− = Mismatch Variable Variable (Maybe Error.Reason)
75+ Mismatch (Maybe Error.Reason)
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
86− ActualExpected ->
85+ ActualExpected ->
87− (second, first, Error.flipReason <$> maybeReason)
86+ Error.flipReason <$> maybeReason
89− throwError (Mismatch expected actual orientedReason)
92badRigid :: Maybe String -> Error.Reason
89badRigid :: Maybe String -> Error.Reason