on master help sign in
Fix #1153
83215bdEvan Czaplicki
src/Reporting/Error/Canonicalize.hs+12−7
@@ -2,6 +2,7 @@
2module Reporting.Error.Canonicalize where
2module Reporting.Error.Canonicalize where
3
3
4import Control.Arrow (second)
4import Control.Arrow (second)
5+import qualified Data.Char as Char
5import Text.PrettyPrint.ANSI.Leijen (indent, text)
6import Text.PrettyPrint.ANSI.Leijen (indent, text)
6
7
7import qualified AST.Module.Name as ModuleName
8import qualified AST.Module.Name as ModuleName
@@ -251,14 +252,18 @@ toReport localizer err =
251
252
252argMismatchReport :: String -> Var.Canonical -> Int -> Int -> Report.Report
253argMismatchReport :: String -> Var.Canonical -> Int -> Int -> Report.Report
253argMismatchReport kind var expected actual =
254argMismatchReport kind var expected actual =
254− Report.report
255+ let
255− "ARGUMENT"
256+ numArgs =
256− Nothing
257+ "too "
257− ( kind ++ " " ++ Var.toString var ++ " has too "
258 ++ (if actual < expected then "few" else "many")
258 ++ (if actual < expected then "few" else "many")
259− ++ " arguments."
259+ ++ " arguments"
260+ in
261+ Report.report
262+ (map Char.toUpper numArgs)
263+ Nothing
264+ ( kind ++ " " ++ Var.toString var ++ " has " ++ numArgs ++ "."
260− )
265+ )
261− (text ("Expecting " ++ show expected ++ ", but got " ++ show actual ++ "."))
266+ (text ("Expecting " ++ show expected ++ ", but got " ++ show actual ++ "."))
262
267
263
268
264extractSuggestions :: Error -> Maybe [String]
269extractSuggestions :: Error -> Maybe [String]