on master help sign in
Add hint about how 1st argument can mess up Nth argument in functions
commit4c43154858e2f4e4a388c316e4d7e320ddba87ed authorEvan Czaplicki <info@elm-lang.org> dateThu 22 Oct 2015, 18:30 (11 years ago) parente6b3f45
1 file changed+11−3
src/Reporting/Error/Type.hs+11−3
src/Reporting/Error/Type.hs+11−3
@@ -123,8 +123,8 @@ mismatchToReport localizer (MismatchInfo hint leftType rightType maybeReason) =
123123
124124 cmpHint leftWords rightWords extraHints =
125125 comparisonHint localizer leftType rightType leftWords rightWords
126− ( map toHint extraHints
127− ++ Maybe.maybeToList (reasonToString =<< maybeReason)
126+ ( Maybe.maybeToList (reasonToString =<< maybeReason)
127+ ++ map toHint extraHints
128128 )
129129 in
130130 case hint of
@@ -295,7 +295,15 @@ mismatchToReport localizer (MismatchInfo hint leftType rightType maybeReason) =
295295 ++ Help.ordinalize index ++ " argument to be:"
296296 )
297297 "But it is:"
298− []
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 ++ "."
305+ ]
306+ )
299307 )
300308
301309 FunctionArity maybeName expected actual region ->