on master help sign in
Add hint about how 1st argument can mess up Nth argument in functions
4c43154Evan Czaplicki
src/Reporting/Error/Type.hs+11−3
@@ -123,8 +123,8 @@ mismatchToReport localizer (MismatchInfo hint leftType rightType maybeReason) =
123
123
124 cmpHint leftWords rightWords extraHints =
124 cmpHint leftWords rightWords extraHints =
125 comparisonHint localizer leftType rightType leftWords rightWords
125 comparisonHint localizer leftType rightType leftWords rightWords
126− ( map toHint extraHints
127− ++ Maybe.maybeToList (reasonToString =<< maybeReason)
126+ ( Maybe.maybeToList (reasonToString =<< maybeReason)
127+ ++ map toHint extraHints
128 )
128 )
129 in
129 in
130 case hint of
130 case hint of
@@ -295,7 +295,15 @@ mismatchToReport localizer (MismatchInfo hint leftType rightType maybeReason) =
295 ++ Help.ordinalize index ++ " argument to be:"
295 ++ Help.ordinalize index ++ " argument to be:"
296 )
296 )
297 "But it is:"
297 "But it is:"
298+ ( if index == 1 then
299+ []
300+ else
301+ [ "I always figure out the type of arguments from left to right. If an argument\
302+ \ is acceptable when I check it, I assume it is \"correct\" in subsequent checks.\
303+ \ So the problem may actually be in how previous arguments interact with the "
304+ ++ Help.ordinalize index ++ "."
298− []
305+ ]
306+ )
299 )
307 )
300
308
301 FunctionArity maybeName expected actual region ->
309 FunctionArity maybeName expected actual region ->