@@ -24,7 +24,7 @@ unify hint region expected actual =
2424 Right state ->
2525 return state
2626
27− Left (Mismatch _subExpected _subActual maybeReason) ->
27+ Left (Mismatch maybeReason) ->
2828 let
2929 mkError =
3030 do expectedSrcType <- Type.toSrcType expected
@@ -71,22 +71,19 @@ reorient (Context orientation var1 desc1 var2 desc2) =
7171-- ERROR MESSAGES
7272
7373
74−data Mismatch
75− = Mismatch Variable Variable (Maybe Error.Reason)
74+newtype Mismatch =
75+ Mismatch (Maybe Error.Reason)
7676
7777
7878mismatch :: Context -> Maybe Error.Reason -> Unify a
79−mismatch (Context orientation first _ second _) maybeReason =
80− let
81− (expected, actual, orientedReason) =
82− case orientation of
83− ExpectedActual ->
84− (first, second, maybeReason)
85−
86− ActualExpected ->
87− (second, first, Error.flipReason <$> maybeReason)
88− in
89− throwError (Mismatch expected actual orientedReason)
79+mismatch (Context orientation _ _ _ _) maybeReason =
80+ throwError $ Mismatch $
81+ case orientation of
82+ ExpectedActual ->
83+ maybeReason
84+
85+ ActualExpected ->
86+ Error.flipReason <$> maybeReason
9087
9188
9289badRigid :: Maybe String -> Error.Reason