@@ -315,12 +315,13 @@ unifySuper context super otherContent =
315315
316316 Var Flex (Just otherSuper) _ ->
317317 case combineFlexSupers super otherSuper of
318− Left reason ->
319− mismatch context (Just reason)
320−
321− Right newSuper ->
318+ Just newSuper ->
322319 merge context (Var Flex (Just newSuper) Nothing)
323320
321+ Nothing ->
322+ mismatch context $ Just $
323+ doubleBad (errorSuper super) (errorSuper otherSuper)
324+
324325 Alias _ _ realVar ->
325326 subUnify context (_first context) realVar
326327
@@ -328,27 +329,35 @@ unifySuper context super otherContent =
328329 return ()
329330
330331
331−combineFlexSupers :: Super -> Super -> Either Error.Reason Super
332+combineFlexSupers :: Super -> Super -> Maybe Super
332333combineFlexSupers firstSuper secondSuper =
333− case (firstSuper, secondSuper) of
334− (Number , Number ) -> Right Number
335− (Comparable, Number ) -> Right Number
336− (Number , Comparable) -> Right Number
337−
338− (Comparable, Comparable) -> Right Comparable
339− (Appendable, Appendable) -> Right Appendable
334+ case firstSuper of
335+ Number ->
336+ case secondSuper of
337+ Number -> Just firstSuper
338+ Comparable -> Just firstSuper
339+ _ -> Nothing
340340
341− (Appendable, Comparable) -> Right CompAppend
342− (Comparable, Appendable) -> Right CompAppend
341+ Comparable ->
342+ case secondSuper of
343+ Comparable -> Just secondSuper
344+ Number -> Just secondSuper
345+ Appendable -> Just CompAppend
346+ CompAppend -> Just secondSuper
343347
344− (CompAppend, CompAppend) -> Right CompAppend
345− (CompAppend, Comparable) -> Right CompAppend
346− (Comparable, CompAppend) -> Right CompAppend
347− (CompAppend, Appendable) -> Right CompAppend
348− (Appendable, CompAppend) -> Right CompAppend
348+ Appendable ->
349+ case secondSuper of
350+ Comparable -> Just CompAppend
351+ Appendable -> Just secondSuper
352+ CompAppend -> Just secondSuper
353+ Number -> Nothing
349354
350− (_ , _ ) ->
351− Left $ doubleBad (errorSuper firstSuper) (errorSuper secondSuper)
355+ CompAppend ->
356+ case secondSuper of
357+ Comparable -> Just firstSuper
358+ Appendable -> Just firstSuper
359+ CompAppend -> Just firstSuper
360+ Number -> Nothing
352361
353362
354363combineRigidSupers :: Super -> Super -> Bool