@@ -75,6 +75,7 @@ data Hint
75 | Pattern Pattern
75 | Pattern Pattern
78+ | Access (Maybe String) String
79 -- effect manager problems
80 -- effect manager problems
80 | Manager String
81 | Manager String
@@ -145,11 +146,12 @@ mismatchToReport localizer (MismatchInfo hint leftType rightType maybeReason) =
146 Report.report "TYPE MISMATCH"
147 Report.report "TYPE MISMATCH"
150+ Maybe.maybeToList (reasonToString =<< maybeReason)
148 cmpHint leftWords rightWords extraHints =
152 cmpHint leftWords rightWords extraHints =
149 comparisonHint localizer leftType rightType leftWords rightWords
153 comparisonHint localizer leftType rightType leftWords rightWords
150− ( Maybe.maybeToList (reasonToString =<< maybeReason)
151− ++ map toHint extraHints
154+ (typicalHints ++ map toHint extraHints)
154 case hint of
156 case hint of
155 CaseBranch branchNumber region ->
157 CaseBranch branchNumber region ->
@@ -446,6 +448,30 @@ mismatchToReport localizer (MismatchInfo hint leftType rightType maybeReason) =
451+ Access (Just body) field ->
454+ "`" ++ body ++ "` does not have a field named `" ++ field ++ "`."
456+ report Nothing header $ Help.stack $
457+ [ Help.reflowParagraph $ "The type of `" ++ body ++ "` is:"
458+ , indent 4 $ dullyellow $ RenderType.toDoc localizer leftType
459+ , Help.reflowParagraph $ "Which does not contain a field named `" ++ field ++ "`."
463+ Access Nothing field ->
466+ "Cannot access a field named `" ++ field ++ "`."
468+ report Nothing header $ Help.stack $
469+ [ Help.reflowParagraph $ "You are trying to get `" ++ field ++ "` from a value with this type:"
470+ , indent 4 $ dullyellow $ RenderType.toDoc localizer leftType
471+ , Help.reflowParagraph $ "It is not in there!"
449 Record ->
475 Record ->
@@ -653,7 +679,7 @@ reasonToString reason =
653 (fields, maybeDeepReason) =
679 (fields, maybeDeepReason) =
654 collectFields reason
680 collectFields reason
656− mabyeDocs =
682+ maybeDocs =
657 reasonToStringHelp =<< maybeDeepReason
683 reasonToStringHelp =<< maybeDeepReason
659 starter =
685 starter =
@@ -667,7 +693,7 @@ reasonToString reason =
668 Just $ "Problem at `" ++ List.intercalate "." fields ++ "`. "
694 Just $ "Problem at `" ++ List.intercalate "." fields ++ "`. "
670− case (starter, mabyeDocs) of
696+ case (starter, maybeDocs) of
671 (Nothing, Nothing) ->
697 (Nothing, Nothing) ->