on master help sign in
Remove duplicate theories in syntax errors
5715966Evan Czaplicki
src/Reporting/Error/Syntax.hs+5−5
@@ -13,8 +13,8 @@ module Reporting.Error.Syntax
13
13
14
14
15import Data.Monoid ((<>))
15import Data.Monoid ((<>))
16+import qualified Data.Set as Set
16import qualified Data.Text as Text
17import qualified Data.Text as Text
17−import Data.Text (Text)
18
18
19import qualified Elm.Name as N
19import qualified Elm.Name as N
20import qualified Reporting.Region as R
20import qualified Reporting.Region as R
@@ -59,7 +59,7 @@ data Problem
59 | BadNumberHex
59 | BadNumberHex
60 | BadNumberZero
60 | BadNumberZero
61 | FloatInPattern
61 | FloatInPattern
62− | BadShader Text
62+ | BadShader Text.Text
63 | BadUnderscore Int
63 | BadUnderscore Int
64 | BadOp BadOp ContextStack
64 | BadOp BadOp ContextStack
65 | Theories ContextStack [Theory]
65 | Theories ContextStack [Theory]
@@ -76,9 +76,9 @@ data BadOp = HasType | Equals | Arrow | Pipe | Dot
76
76
77
77
78data Theory
78data Theory
79+ = Expecting Next
79− = Keyword String
80+ | Keyword String
80 | Symbol String
81 | Symbol String
81− | Expecting Next
82 | LowVar
82 | LowVar
83 | CapVar
83 | CapVar
84 | InfixOp
84 | InfixOp
@@ -497,7 +497,7 @@ problemToDocs problem =
497 H.reflow $
497 H.reflow $
498 "Something went wrong while parsing " <> contextToString "your code" "" stack <> "."
498 "Something went wrong while parsing " <> contextToString "your code" "" stack <> "."
499 ,
499 ,
500− case allTheories of
500+ case Set.toList (Set.fromList allTheories) of
501 [] ->
501 [] ->
502 H.stack
502 H.stack
503 [ H.reflow $
503 [ H.reflow $