on master help sign in
Have the REPL parser expose Names rather than Strings
06847f6Evan Czaplicki
src/Parse/Repl.hs+7−6
@@ -12,6 +12,7 @@ import qualified Data.Text as Text
12import Data.Text (Text)
12import Data.Text (Text)
13
13
14import qualified AST.Source as Src
14import qualified AST.Source as Src
15+import qualified Elm.Name as N
15import Parse.Primitives
16import Parse.Primitives
16import qualified Parse.Primitives.Keyword as Keyword
17import qualified Parse.Primitives.Keyword as Keyword
17import qualified Parse.Primitives.Symbol as Symbol
18import qualified Parse.Primitives.Symbol as Symbol
@@ -25,9 +26,9 @@ import qualified Reporting.Annotation as A
25
26
26
27
27data Entry
28data Entry
28− = Import String Text
29+ = Import N.Name Text
29− | Type String Text
30+ | Type N.Name Text
30− | Def (Maybe String) Text
31+ | Def (Maybe N.Name) Text
31 | Other Text
32 | Other Text
32 | Annotation
33 | Annotation
33 | Port
34 | Port
@@ -57,7 +58,7 @@ entryParser source =
57 [ do Keyword.import_
58 [ do Keyword.import_
58 spaces
59 spaces
59 name <- Var.moduleName
60 name <- Var.moduleName
60− return (Import (Text.unpack name) source)
61+ return (Import name source)
61
62
62 , do Keyword.port_
63 , do Keyword.port_
63 return Port
64 return Port
@@ -70,7 +71,7 @@ entryParser source =
70 , return ()
71 , return ()
71 ]
72 ]
72 name <- Var.upper
73 name <- Var.upper
73− return (Type (Text.unpack name) source)
74+ return (Type name source)
74
75
75 , do root <- Pattern.term
76 , do root <- Pattern.term
76 spaces
77 spaces
@@ -80,7 +81,7 @@ entryParser source =
80 [ do Symbol.hasType
81 [ do Symbol.hasType
81 return Annotation
82 return Annotation
82 , do chompArgs
83 , do chompArgs
83− return (Def (Just (Text.unpack name)) source)
84+ return (Def (Just name) source)
84 ]
85 ]
85
86
86 _ ->
87 _ ->