on master help sign in
Attach Localizer only for type errors

I cannot think of other cases where it is needed (though they may exist!) and this lets me generate the Localizer value only as needed. It also lets me drop some arguments that force me to create it at a more difficult time.

commitf320cea795d9b5557e8373ea30ecbfb03e333159 authorEvan Czaplicki <evancz@users.noreply.github.com> dateWed 18 Apr 2018, 14:30 (9 years ago) parent296396a
1 file changed+5−5
compiler/src/Reporting/Error.hs+5−5
compiler/src/Reporting/Error.hs+5−5
@@ -7,7 +7,6 @@ module Reporting.Error
77 where
88
99
10−import qualified Type.Error
1110import qualified Reporting.Error.Canonicalize as Canonicalize
1211import qualified Reporting.Error.Docs as Docs
1312import qualified Reporting.Error.Main as Main
@@ -15,6 +14,7 @@ import qualified Reporting.Error.Pattern as Pattern
1514import qualified Reporting.Error.Syntax as Syntax
1615import qualified Reporting.Error.Type as Type
1716import qualified Reporting.Render.Code as Code
17+import qualified Reporting.Render.Type.Localizer as L
1818import qualified Reporting.Report as Report
1919
2020
@@ -25,7 +25,7 @@ import qualified Reporting.Report as Report
2525data Error
2626 = Syntax Syntax.Error
2727 | Canonicalize Canonicalize.Error
28− | Type [Type.Error]
28+ | Type L.Localizer [Type.Error]
2929 | Main Main.Error
3030 | Pattern [Pattern.Error]
3131 | Docs Docs.Error
@@ -35,8 +35,8 @@ data Error
3535-- TO REPORT
3636
3737
38−toReports :: Code.Source -> Type.Error.Localizer -> Error -> [Report.Report]
39−toReports source localizer err =
38+toReports :: Code.Source -> Error -> [Report.Report]
39+toReports source err =
4040 case err of
4141 Syntax syntaxError ->
4242 [Syntax.toReport source syntaxError]
@@ -44,7 +44,7 @@ toReports source localizer err =
4444 Canonicalize canonicalizeError ->
4545 [Canonicalize.toReport source canonicalizeError]
4646
47− Type typeErrors ->
47+ Type localizer typeErrors ->
4848 map (Type.toReport source localizer) typeErrors
4949
5050 Main mainError ->