on master help sign in
Switch Elm/ to Data.Name if only needed qualifier changes
d331101Evan Czaplicki
compiler/src/Elm/Compiler/Imports.hs+13−12
@@ -6,9 +6,10 @@ module Elm.Compiler.Imports
6 where
6 where
7
7
8
8
9+import qualified Data.Name as Name
10+
9import qualified AST.Source as Src
11import qualified AST.Source as Src
10import qualified AST.Module.Name as Module
12import qualified AST.Module.Name as Module
11−import qualified Elm.Name as N
12import qualified Elm.Package as Pkg
13import qualified Elm.Package as Pkg
13import qualified Reporting.Annotation as A
14import qualified Reporting.Annotation as A
14import qualified Reporting.Region as R
15import qualified Reporting.Region as R
@@ -34,18 +35,18 @@ defaults =
34 [ import_ Module.basics Nothing Src.Open
35 [ import_ Module.basics Nothing Src.Open
35 , import_ Module.debug Nothing closed
36 , import_ Module.debug Nothing closed
36 , import_ Module.list Nothing (operator "::")
37 , import_ Module.list Nothing (operator "::")
37− , import_ Module.maybe Nothing (typeOpen N.maybe)
38+ , import_ Module.maybe Nothing (typeOpen Name.maybe)
38− , import_ Module.result Nothing (typeOpen N.result)
39+ , import_ Module.result Nothing (typeOpen Name.result)
39− , import_ Module.string Nothing (typeClosed N.string)
40+ , import_ Module.string Nothing (typeClosed Name.string)
40− , import_ Module.char Nothing (typeClosed N.char)
41+ , import_ Module.char Nothing (typeClosed Name.char)
41 , import_ Module.tuple Nothing closed
42 , import_ Module.tuple Nothing closed
42− , import_ Module.platform Nothing (typeClosed N.program)
43+ , import_ Module.platform Nothing (typeClosed Name.program)
43− , import_ Module.cmd (Just N.cmd) (typeClosed N.cmd)
44+ , import_ Module.cmd (Just Name.cmd) (typeClosed Name.cmd)
44− , import_ Module.sub (Just N.sub) (typeClosed N.sub)
45+ , import_ Module.sub (Just Name.sub) (typeClosed Name.sub)
45 ]
46 ]
46
47
47
48
48−import_ :: Module.Canonical -> Maybe N.Name -> Src.Exposing -> Src.Import
49+import_ :: Module.Canonical -> Maybe Name.Name -> Src.Exposing -> Src.Import
49import_ (Module.Canonical _ name) maybeAlias exposing =
50import_ (Module.Canonical _ name) maybeAlias exposing =
50 Src.Import (A.At R.zero name) maybeAlias exposing
51 Src.Import (A.At R.zero name) maybeAlias exposing
51
52
@@ -59,16 +60,16 @@ closed =
59 Src.Explicit []
60 Src.Explicit []
60
61
61
62
62−typeOpen :: N.Name -> Src.Exposing
63+typeOpen :: Name.Name -> Src.Exposing
63typeOpen name =
64typeOpen name =
64 Src.Explicit [ A.At R.zero (Src.Upper name Src.Public) ]
65 Src.Explicit [ A.At R.zero (Src.Upper name Src.Public) ]
65
66
66
67
67−typeClosed :: N.Name -> Src.Exposing
68+typeClosed :: Name.Name -> Src.Exposing
68typeClosed name =
69typeClosed name =
69 Src.Explicit [ A.At R.zero (Src.Upper name Src.Private) ]
70 Src.Explicit [ A.At R.zero (Src.Upper name Src.Private) ]
70
71
71
72
72−operator :: N.Name -> Src.Exposing
73+operator :: Name.Name -> Src.Exposing
73operator op =
74operator op =
74 Src.Explicit [ A.At R.zero (Src.Operator op) ]
75 Src.Explicit [ A.At R.zero (Src.Operator op) ]
compiler/src/Elm/Compiler/Objects.hs+7−7
@@ -15,10 +15,10 @@ module Elm.Compiler.Objects
15
15
16import qualified Data.List as List
16import qualified Data.List as List
17import qualified Data.Map as Map
17import qualified Data.Map as Map
18+import qualified Data.Name as Name
18
19
19import qualified AST.Optimized as Opt
20import qualified AST.Optimized as Opt
20import qualified AST.Module.Name as ModuleName
21import qualified AST.Module.Name as ModuleName
21−import qualified Elm.Name as N
22import qualified Elm.Package as Pkg
22import qualified Elm.Package as Pkg
23import qualified Generate.JavaScript as JS
23import qualified Generate.JavaScript as JS
24
24
@@ -62,7 +62,7 @@ data Kernel =
62 }
62 }
63
63
64
64
65−fromKernels :: Map.Map N.Name Kernel -> Opt.Graph
65+fromKernels :: Map.Map Name.Name Kernel -> Opt.Graph
66fromKernels kernels =
66fromKernels kernels =
67 Opt.Graph
67 Opt.Graph
68 Map.empty
68 Map.empty
@@ -74,9 +74,9 @@ fromKernels kernels =
74-- KERNEL TO NODES
74-- KERNEL TO NODES
75
75
76
76
77−toGlobal :: N.Name -> Opt.Global
77+toGlobal :: Name.Name -> Opt.Global
78toGlobal home =
78toGlobal home =
79− Opt.Global (ModuleName.Canonical Pkg.kernel (ModuleName.getKernel home)) N.dollar
79+ Opt.Global (ModuleName.Canonical Pkg.kernel (Name.getKernel home)) Name.dollar
80
80
81
81
82toNode :: Kernel -> Opt.Node
82toNode :: Kernel -> Opt.Node
@@ -88,17 +88,17 @@ toNode (Kernel client server) =
88-- KERNEL TO ELM FIELDS
88-- KERNEL TO ELM FIELDS
89
89
90
90
91−addKernel :: Map.Map N.Name Int -> Kernel -> Map.Map N.Name Int
91+addKernel :: Map.Map Name.Name Int -> Kernel -> Map.Map Name.Name Int
92addKernel fields (Kernel client maybeServer) =
92addKernel fields (Kernel client maybeServer) =
93 addContent (maybe fields (addContent fields) maybeServer) client
93 addContent (maybe fields (addContent fields) maybeServer) client
94
94
95
95
96−addContent :: Map.Map N.Name Int -> Opt.KContent -> Map.Map N.Name Int
96+addContent :: Map.Map Name.Name Int -> Opt.KContent -> Map.Map Name.Name Int
97addContent fields (Opt.KContent chunks _) =
97addContent fields (Opt.KContent chunks _) =
98 List.foldl' addChunk fields chunks
98 List.foldl' addChunk fields chunks
99
99
100
100
101−addChunk :: Map.Map N.Name Int -> Opt.KChunk -> Map.Map N.Name Int
101+addChunk :: Map.Map Name.Name Int -> Opt.KChunk -> Map.Map Name.Name Int
102addChunk fields chunk =
102addChunk fields chunk =
103 case chunk of
103 case chunk of
104 Opt.ElmField name ->
104 Opt.ElmField name ->
compiler/src/Elm/Compiler/Type.hs+11−11
@@ -14,11 +14,11 @@ module Elm.Compiler.Type
14 where
14 where
15
15
16
16
17+import qualified Data.Name as Name
17import qualified Data.Text as Text
18import qualified Data.Text as Text
18import qualified Data.Text.Encoding as Text
19import qualified Data.Text.Encoding as Text
19
20
20import qualified AST.Source as Src
21import qualified AST.Source as Src
21−import qualified Elm.Name as N
22import qualified Parse.Primitives as Parse
22import qualified Parse.Primitives as Parse
23import qualified Parse.Type as Type
23import qualified Parse.Type as Type
24import qualified Reporting.Annotation as A
24import qualified Reporting.Annotation as A
@@ -37,9 +37,9 @@ import Json.Encode ((==>))
37
37
38data Type
38data Type
39 = Lambda Type Type
39 = Lambda Type Type
40− | Var N.Name
40+ | Var Name.Name
41− | Type N.Name [Type]
41+ | Type Name.Name [Type]
42− | Record [(N.Name, Type)] (Maybe N.Name)
42+ | Record [(Name.Name, Type)] (Maybe Name.Name)
43 | Unit
43 | Unit
44 | Tuple Type Type [Type]
44 | Tuple Type Type [Type]
45
45
@@ -52,8 +52,8 @@ data DebugMetadata =
52 }
52 }
53
53
54
54
55−data Alias = Alias N.Name [N.Name] Type
55+data Alias = Alias Name.Name [Name.Name] Type
56−data Union = Union N.Name [N.Name] [(N.Name, [Type])]
56+data Union = Union Name.Name [Name.Name] [(Name.Name, [Type])]
57
57
58
58
59
59
@@ -94,7 +94,7 @@ toDoc localizer context tipe =
94 (fmap D.fromName ext)
94 (fmap D.fromName ext)
95
95
96
96
97−entryToDoc :: L.Localizer -> (N.Name, Type) -> (D.Doc, D.Doc)
97+entryToDoc :: L.Localizer -> (Name.Name, Type) -> (D.Doc, D.Doc)
98entryToDoc localizer (field, fieldType) =
98entryToDoc localizer (field, fieldType) =
99 ( D.fromName field, toDoc localizer RT.None fieldType )
99 ( D.fromName field, toDoc localizer RT.None fieldType )
100
100
@@ -175,7 +175,7 @@ encodeMetadata (DebugMetadata msg aliases unions) =
175
175
176toAliasField :: Alias -> ( Text.Text, Encode.Value )
176toAliasField :: Alias -> ( Text.Text, Encode.Value )
177toAliasField (Alias name args tipe) =
177toAliasField (Alias name args tipe) =
178− N.toText name ==>
178+ Name.toText name ==>
179 Encode.object
179 Encode.object
180 [ "args" ==> Encode.list Encode.name args
180 [ "args" ==> Encode.list Encode.name args
181 , "type" ==> encode tipe
181 , "type" ==> encode tipe
@@ -184,13 +184,13 @@ toAliasField (Alias name args tipe) =
184
184
185toUnionField :: Union -> ( Text.Text, Encode.Value )
185toUnionField :: Union -> ( Text.Text, Encode.Value )
186toUnionField (Union name args constructors) =
186toUnionField (Union name args constructors) =
187− N.toText name ==>
187+ Name.toText name ==>
188 Encode.object
188 Encode.object
189 [ "args" ==> Encode.list Encode.name args
189 [ "args" ==> Encode.list Encode.name args
190 , "tags" ==> Encode.object (map toCtorObject constructors)
190 , "tags" ==> Encode.object (map toCtorObject constructors)
191 ]
191 ]
192
192
193
193
194−toCtorObject :: (N.Name, [Type]) -> ( Text.Text, Encode.Value )
194+toCtorObject :: (Name.Name, [Type]) -> ( Text.Text, Encode.Value )
195toCtorObject (name, args) =
195toCtorObject (name, args) =
196− N.toText name ==> Encode.list encode args
196+ Name.toText name ==> Encode.list encode args
compiler/src/Elm/Compiler/Type/Extract.hs+5−5
@@ -11,6 +11,7 @@ module Elm.Compiler.Type.Extract
11
11
12import Data.Map ((!))
12import Data.Map ((!))
13import qualified Data.Maybe as Maybe
13import qualified Data.Maybe as Maybe
14+import qualified Data.Name as Name
14import qualified Data.Set as Set
15import qualified Data.Set as Set
15
16
16import qualified AST.Canonical as Can
17import qualified AST.Canonical as Can
@@ -19,7 +20,6 @@ import qualified AST.Module.Name as ModuleName
19import qualified AST.Utils.Type as Type
20import qualified AST.Utils.Type as Type
20import qualified Elm.Compiler.Type as T
21import qualified Elm.Compiler.Type as T
21import qualified Elm.Interface as I
22import qualified Elm.Interface as I
22−import qualified Elm.Name as N
23
23
24
24
25
25
@@ -71,9 +71,9 @@ extract astType =
71 <$> traverse (extract . snd) args
71 <$> traverse (extract . snd) args
72
72
73
73
74−toPublicName :: ModuleName.Canonical -> N.Name -> N.Name
74+toPublicName :: ModuleName.Canonical -> Name.Name -> Name.Name
75toPublicName (ModuleName.Canonical _ home) name =
75toPublicName (ModuleName.Canonical _ home) name =
76− N.sepBy 0x2E {- . -} home name
76+ Name.sepBy 0x2E {- . -} home name
77
77
78
78
79
79
@@ -129,7 +129,7 @@ extractAlias interfaces (Opt.Global home name) =
129
129
130extractUnion :: I.Interfaces -> Opt.Global -> Extractor T.Union
130extractUnion :: I.Interfaces -> Opt.Global -> Extractor T.Union
131extractUnion interfaces (Opt.Global home name) =
131extractUnion interfaces (Opt.Global home name) =
132− if name == N.list && home == ModuleName.list
132+ if name == Name.list && home == ModuleName.list
133 then return $ T.Union (toPublicName home name) ["a"] []
133 then return $ T.Union (toPublicName home name) ["a"] []
134 else
134 else
135 let
135 let
@@ -141,7 +141,7 @@ extractUnion interfaces (Opt.Global home name) =
141 T.Union pname vars <$> traverse extractCtor ctors
141 T.Union pname vars <$> traverse extractCtor ctors
142
142
143
143
144−extractCtor :: Can.Ctor -> Extractor (N.Name, [T.Type])
144+extractCtor :: Can.Ctor -> Extractor (Name.Name, [T.Type])
145extractCtor (Can.Ctor ctor _ _ args) =
145extractCtor (Can.Ctor ctor _ _ args) =
146 (,) ctor <$> traverse extract args
146 (,) ctor <$> traverse extract args
147
147
compiler/src/Elm/Docs.hs+39−39
@@ -22,6 +22,7 @@ import qualified Data.ByteString as B
22import qualified Data.List as List
22import qualified Data.List as List
23import Data.Map ((!))
23import Data.Map ((!))
24import qualified Data.Map as Map
24import qualified Data.Map as Map
25+import qualified Data.Name as Name
25import qualified Data.Text as Text
26import qualified Data.Text as Text
26import qualified Data.Text.Encoding as Text
27import qualified Data.Text.Encoding as Text
27
28
@@ -32,7 +33,6 @@ import qualified Data.OneOrMore as OneOrMore
32import qualified Elm.Compiler.Module as Module
33import qualified Elm.Compiler.Module as Module
33import qualified Elm.Compiler.Type as Type
34import qualified Elm.Compiler.Type as Type
34import qualified Elm.Compiler.Type.Extract as Extract
35import qualified Elm.Compiler.Type.Extract as Extract
35−import qualified Elm.Name as N
36import qualified Json.Decode as D
36import qualified Json.Decode as D
37import qualified Json.Encode as E
37import qualified Json.Encode as E
38import Json.Encode ((==>))
38import Json.Encode ((==>))
@@ -53,7 +53,7 @@ import qualified Parse.Primitives.Whitespace as W
53
53
54
54
55type Documentation =
55type Documentation =
56− Map.Map N.Name Module
56+ Map.Map Name.Name Module
57
57
58
58
59toDict :: [Module] -> Documentation
59toDict :: [Module] -> Documentation
@@ -62,7 +62,7 @@ toDict modules =
62
62
63
63
64
64
65−toPair :: Module -> (N.Name, Module)
65+toPair :: Module -> (Name.Name, Module)
66toPair modul@(Module name _ _ _ _ _) =
66toPair modul@(Module name _ _ _ _ _) =
67 (name, modul)
67 (name, modul)
68
68
@@ -73,20 +73,20 @@ toPair modul@(Module name _ _ _ _ _) =
73
73
74data Module =
74data Module =
75 Module
75 Module
76− { _name :: N.Name
76+ { _name :: Name.Name
77 , _comment :: Comment
77 , _comment :: Comment
78− , _unions :: Map.Map N.Name Union
78+ , _unions :: Map.Map Name.Name Union
79− , _aliases :: Map.Map N.Name Alias
79+ , _aliases :: Map.Map Name.Name Alias
80− , _values :: Map.Map N.Name Value
80+ , _values :: Map.Map Name.Name Value
81− , _binops :: Map.Map N.Name Binop
81+ , _binops :: Map.Map Name.Name Binop
82 }
82 }
83
83
84
84
85type Comment = Text.Text
85type Comment = Text.Text
86
86
87
87
88−data Alias = Alias Comment [N.Name] Type.Type
88+data Alias = Alias Comment [Name.Name] Type.Type
89−data Union = Union Comment [N.Name] [(N.Name, [Type.Type])]
89+data Union = Union Comment [Name.Name] [(Name.Name, [Type.Type])]
90data Value = Value Comment Type.Type
90data Value = Value Comment Type.Type
91data Binop = Binop Comment Type.Type Binop.Associativity Binop.Precedence
91data Binop = Binop Comment Type.Type Binop.Associativity Binop.Precedence
92
92
@@ -124,19 +124,19 @@ decoder =
124 <*> D.field "binops" (dictDecoder binop)
124 <*> D.field "binops" (dictDecoder binop)
125
125
126
126
127−dictDecoder :: D.Decoder Error a -> D.Decoder Error (Map.Map N.Name a)
127+dictDecoder :: D.Decoder Error a -> D.Decoder Error (Map.Map Name.Name a)
128dictDecoder entryDecoder =
128dictDecoder entryDecoder =
129 Map.fromList <$> D.list (named entryDecoder)
129 Map.fromList <$> D.list (named entryDecoder)
130
130
131
131
132−named :: D.Decoder Error a -> D.Decoder Error (N.Name, a)
132+named :: D.Decoder Error a -> D.Decoder Error (Name.Name, a)
133named entryDecoder =
133named entryDecoder =
134 (,)
134 (,)
135 <$> D.field "name" D.name
135 <$> D.field "name" D.name
136 <*> entryDecoder
136 <*> entryDecoder
137
137
138
138
139−nameDecoder :: D.Decoder Error N.Name
139+nameDecoder :: D.Decoder Error Name.Name
140nameDecoder =
140nameDecoder =
141 D.mapError (const BadName) Module.decoder
141 D.mapError (const BadName) Module.decoder
142
142
@@ -150,7 +150,7 @@ typeDecoder =
150-- UNION JSON
150-- UNION JSON
151
151
152
152
153−encodeUnion :: (N.Name, Union) -> E.Value
153+encodeUnion :: (Name.Name, Union) -> E.Value
154encodeUnion (name, Union comment args cases) =
154encodeUnion (name, Union comment args cases) =
155 E.object
155 E.object
156 [ "name" ==> E.name name
156 [ "name" ==> E.name name
@@ -168,12 +168,12 @@ union =
168 <*> D.field "cases" (D.list caseDecoder)
168 <*> D.field "cases" (D.list caseDecoder)
169
169
170
170
171−encodeCase :: ( N.Name, [Type.Type] ) -> E.Value
171+encodeCase :: ( Name.Name, [Type.Type] ) -> E.Value
172encodeCase ( tag, args ) =
172encodeCase ( tag, args ) =
173 E.list id [ E.name tag, E.list Type.encode args ]
173 E.list id [ E.name tag, E.list Type.encode args ]
174
174
175
175
176−caseDecoder :: D.Decoder Error ( N.Name, [Type.Type] )
176+caseDecoder :: D.Decoder Error ( Name.Name, [Type.Type] )
177caseDecoder =
177caseDecoder =
178 D.pair D.name (D.list typeDecoder)
178 D.pair D.name (D.list typeDecoder)
179
179
@@ -182,7 +182,7 @@ caseDecoder =
182-- ALIAS JSON
182-- ALIAS JSON
183
183
184
184
185−encodeAlias :: (N.Name, Alias) -> E.Value
185+encodeAlias :: (Name.Name, Alias) -> E.Value
186encodeAlias ( name, Alias comment args tipe) =
186encodeAlias ( name, Alias comment args tipe) =
187 E.object
187 E.object
188 [ "name" ==> E.name name
188 [ "name" ==> E.name name
@@ -204,7 +204,7 @@ alias =
204-- VALUE JSON
204-- VALUE JSON
205
205
206
206
207−encodeValue :: (N.Name, Value) -> E.Value
207+encodeValue :: (Name.Name, Value) -> E.Value
208encodeValue (name, Value comment tipe) =
208encodeValue (name, Value comment tipe) =
209 E.object
209 E.object
210 [ "name" ==> E.name name
210 [ "name" ==> E.name name
@@ -224,7 +224,7 @@ value =
224-- BINOP JSON
224-- BINOP JSON
225
225
226
226
227−encodeBinop :: (N.Name, Binop) -> E.Value
227+encodeBinop :: (Name.Name, Binop) -> E.Value
228encodeBinop (name, Binop comment tipe assoc prec) =
228encodeBinop (name, Binop comment tipe assoc prec) =
229 E.object
229 E.object
230 [ "name" ==> E.name name
230 [ "name" ==> E.name name
@@ -314,7 +314,7 @@ emptyModule (ModuleName.Canonical _ name) overview =
314-- PARSE OVERVIEW
314-- PARSE OVERVIEW
315
315
316
316
317−parseOverview :: R.Region -> B.ByteString -> Result.Result i w Error.Error [A.Located N.Name]
317+parseOverview :: R.Region -> B.ByteString -> Result.Result i w Error.Error [A.Located Name.Name]
318parseOverview (R.Region (R.Position row col) _) overview =
318parseOverview (R.Region (R.Position row col) _) overview =
319 case P.runAt row (col + 3) (chompOverview []) overview of
319 case P.runAt row (col + 3) (chompOverview []) overview of
320 Left err ->
320 Left err ->
@@ -324,7 +324,7 @@ parseOverview (R.Region (R.Position row col) _) overview =
324 Result.ok names
324 Result.ok names
325
325
326
326
327−chompOverview :: [A.Located N.Name] -> Parser [A.Located N.Name]
327+chompOverview :: [A.Located Name.Name] -> Parser [A.Located Name.Name]
328chompOverview names =
328chompOverview names =
329 do isDocs <- W.chompUntilDocs
329 do isDocs <- W.chompUntilDocs
330 if isDocs
330 if isDocs
@@ -332,7 +332,7 @@ chompOverview names =
332 else return names
332 else return names
333
333
334
334
335−chompOverviewHelp :: [A.Located N.Name] -> Parser [A.Located N.Name]
335+chompOverviewHelp :: [A.Located Name.Name] -> Parser [A.Located Name.Name]
336chompOverviewHelp names =
336chompOverviewHelp names =
337 do pos <- P.getPosition
337 do pos <- P.getPosition
338 (W.SPos spos) <- W.whitespace
338 (W.SPos spos) <- W.whitespace
@@ -341,7 +341,7 @@ chompOverviewHelp names =
341 else chompOverview =<< chompDocs names
341 else chompOverview =<< chompDocs names
342
342
343
343
344−chompDocs :: [A.Located N.Name] -> Parser [A.Located N.Name]
344+chompDocs :: [A.Located Name.Name] -> Parser [A.Located Name.Name]
345chompDocs names =
345chompDocs names =
346 do name <- P.addLocation (P.oneOf [ Var.lower, Var.upper, chompBinop ])
346 do name <- P.addLocation (P.oneOf [ Var.lower, Var.upper, chompBinop ])
347 spos <- W.whitespace
347 spos <- W.whitespace
@@ -354,7 +354,7 @@ chompDocs names =
354 ]
354 ]
355
355
356
356
357−chompBinop :: Parser N.Name
357+chompBinop :: Parser Name.Name
358chompBinop =
358chompBinop =
359 do Symbol.leftParen
359 do Symbol.leftParen
360 name <- Symbol.binop
360 name <- Symbol.binop
@@ -371,10 +371,10 @@ type Result i w a =
371
371
372
372
373type Dups =
373type Dups =
374− Map.Map N.Name (OneOrMore.OneOrMore R.Region)
374+ Map.Map Name.Name (OneOrMore.OneOrMore R.Region)
375
375
376
376
377−checkNames :: Map.Map N.Name (A.Located Can.Export) -> [A.Located N.Name] -> Result i w ()
377+checkNames :: Map.Map Name.Name (A.Located Can.Export) -> [A.Located Name.Name] -> Result i w ()
378checkNames exports names =
378checkNames exports names =
379 do docs <- Map.traverseWithKey isUnique (List.foldl' addName Map.empty names)
379 do docs <- Map.traverseWithKey isUnique (List.foldl' addName Map.empty names)
380 let overlap = Map.size (Map.intersection docs exports)
380 let overlap = Map.size (Map.intersection docs exports)
@@ -386,12 +386,12 @@ checkNames exports names =
386 Result.ok ()
386 Result.ok ()
387
387
388
388
389−addName :: Dups -> A.Located N.Name -> Dups
389+addName :: Dups -> A.Located Name.Name -> Dups
390addName dict (A.At region name) =
390addName dict (A.At region name) =
391 Map.insertWith OneOrMore.more name (OneOrMore.one region) dict
391 Map.insertWith OneOrMore.more name (OneOrMore.one region) dict
392
392
393
393
394−isUnique :: N.Name -> OneOrMore.OneOrMore R.Region -> Result i w R.Region
394+isUnique :: Name.Name -> OneOrMore.OneOrMore R.Region -> Result i w R.Region
395isUnique name regions =
395isUnique name regions =
396 case regions of
396 case regions of
397 OneOrMore.One region ->
397 OneOrMore.One region ->
@@ -402,12 +402,12 @@ isUnique name regions =
402 Result.throw (E.Duplicate name r1 r2)
402 Result.throw (E.Duplicate name r1 r2)
403
403
404
404
405−onlyInDocs :: N.Name -> R.Region -> Result i w a
405+onlyInDocs :: Name.Name -> R.Region -> Result i w a
406onlyInDocs name region =
406onlyInDocs name region =
407 Result.throw $ E.OnlyInDocs name region
407 Result.throw $ E.OnlyInDocs name region
408
408
409
409
410−onlyInExports :: N.Name -> A.Located Can.Export -> Result i w a
410+onlyInExports :: Name.Name -> A.Located Can.Export -> Result i w a
411onlyInExports name (A.At region _) =
411onlyInExports name (A.At region _) =
412 Result.throw $ E.OnlyInExports name region
412 Result.throw $ E.OnlyInExports name region
413
413
@@ -418,16 +418,16 @@ onlyInExports name (A.At region _) =
418
418
419data Info =
419data Info =
420 Info
420 Info
421− { _iComments :: Map.Map N.Name Comment
421+ { _iComments :: Map.Map Name.Name Comment
422 , _iValues :: Types
422 , _iValues :: Types
423− , _iUnions :: Map.Map N.Name Can.Union
423+ , _iUnions :: Map.Map Name.Name Can.Union
424− , _iAliases :: Map.Map N.Name Can.Alias
424+ , _iAliases :: Map.Map Name.Name Can.Alias
425− , _iBinops :: Map.Map N.Name Can.Binop
425+ , _iBinops :: Map.Map Name.Name Can.Binop
426 , _iEffects :: Can.Effects
426 , _iEffects :: Can.Effects
427 }
427 }
428
428
429
429
430−checkExport :: Info -> N.Name -> A.Located Can.Export -> Result i w (Module -> Module)
430+checkExport :: Info -> Name.Name -> A.Located Can.Export -> Result i w (Module -> Module)
431checkExport info name (A.At region export) =
431checkExport info name (A.At region export) =
432 case export of
432 case export of
433 Can.ExportValue ->
433 Can.ExportValue ->
@@ -468,7 +468,7 @@ checkExport info name (A.At region export) =
468 m { _values = Map.insert name (Value comment tipe) (_values m) }
468 m { _values = Map.insert name (Value comment tipe) (_values m) }
469
469
470
470
471−getComment :: R.Region -> N.Name -> Info -> Result i w Comment
471+getComment :: R.Region -> Name.Name -> Info -> Result i w Comment
472getComment region name info =
472getComment region name info =
473 case Map.lookup name (_iComments info) of
473 case Map.lookup name (_iComments info) of
474 Nothing ->
474 Nothing ->
@@ -478,7 +478,7 @@ getComment region name info =
478 Result.ok comment
478 Result.ok comment
479
479
480
480
481−getType :: N.Name -> Info -> Result i w Type.Type
481+getType :: Name.Name -> Info -> Result i w Type.Type
482getType name info =
482getType name info =
483 case _iValues info ! name of
483 case _iValues info ! name of
484 A.At defRegion Nothing ->
484 A.At defRegion Nothing ->
@@ -488,7 +488,7 @@ getType name info =
488 Result.ok (Extract.fromType tipe)
488 Result.ok (Extract.fromType tipe)
489
489
490
490
491−dector :: Can.Ctor -> (N.Name, [Type.Type])
491+dector :: Can.Ctor -> (Name.Name, [Type.Type])
492dector (Can.Ctor name _ _ args) =
492dector (Can.Ctor name _ _ args) =
493 ( name, map Extract.fromType args )
493 ( name, map Extract.fromType args )
494
494
@@ -498,7 +498,7 @@ dector (Can.Ctor name _ _ args) =
498
498
499
499
500type Types =
500type Types =
501− Map.Map N.Name (A.Located (Maybe Can.Type))
501+ Map.Map Name.Name (A.Located (Maybe Can.Type))
502
502
503
503
504gatherTypes :: Can.Decls -> Types -> Types
504gatherTypes :: Can.Decls -> Types -> Types
compiler/src/Elm/Header.hs+3−3
@@ -7,10 +7,10 @@ module Elm.Header
7
7
8
8
9import qualified Data.ByteString as B
9import qualified Data.ByteString as B
10+import qualified Data.Name as Name
10
11
11import qualified AST.Source as Src
12import qualified AST.Source as Src
12import qualified Elm.Compiler.Module as M
13import qualified Elm.Compiler.Module as M
13−import qualified Elm.Name as N
14import qualified Elm.Package as Pkg
14import qualified Elm.Package as Pkg
15import qualified Parse.Primitives as Parser
15import qualified Parse.Primitives as Parser
16import qualified Parse.Module as Module
16import qualified Parse.Module as Module
@@ -46,7 +46,7 @@ parse pkgName sourceCode =
46 Left (Error.Syntax err)
46 Left (Error.Syntax err)
47
47
48
48
49−getName :: Src.Import -> N.Name
49+getName :: Src.Import -> Name.Name
50getName (Src.Import (A.At _ name) _ _) =
50getName (Src.Import (A.At _ name) _ _) =
51 name
51 name
52
52
@@ -55,7 +55,7 @@ getName (Src.Import (A.At _ name) _ _) =
55-- TO HEADER
55-- TO HEADER
56
56
57
57
58−simplifyHeader :: Src.Header -> (Tag, N.Name)
58+simplifyHeader :: Src.Header -> (Tag, Name.Name)
59simplifyHeader (Src.Header name effects _ _) =
59simplifyHeader (Src.Header name effects _ _) =
60 ( toTag effects, name )
60 ( toTag effects, name )
61
61
compiler/src/Elm/Interface.hs+11−11
@@ -19,11 +19,11 @@ import Data.Binary
19import Data.Map ((!))
19import Data.Map ((!))
20import qualified Data.Map as Map
20import qualified Data.Map as Map
21import qualified Data.Map.Merge.Strict as Map
21import qualified Data.Map.Merge.Strict as Map
22+import qualified Data.Name as Name
22
23
23import qualified AST.Canonical as Can
24import qualified AST.Canonical as Can
24import qualified AST.Module.Name as ModuleName
25import qualified AST.Module.Name as ModuleName
25import qualified AST.Utils.Binop as Binop
26import qualified AST.Utils.Binop as Binop
26−import qualified Elm.Name as N
27import qualified Reporting.Annotation as A
27import qualified Reporting.Annotation as A
28
28
29
29
@@ -41,10 +41,10 @@ type Interfaces =
41
41
42data Interface =
42data Interface =
43 Interface
43 Interface
44− { _types :: Map.Map N.Name Can.Annotation
44+ { _types :: Map.Map Name.Name Can.Annotation
45− , _unions :: Map.Map N.Name Union
45+ , _unions :: Map.Map Name.Name Union
46− , _aliases :: Map.Map N.Name Alias
46+ , _aliases :: Map.Map Name.Name Alias
47− , _binops :: Map.Map N.Name Binop
47+ , _binops :: Map.Map Name.Name Binop
48 }
48 }
49
49
50
50
@@ -61,7 +61,7 @@ data Alias
61
61
62data Binop =
62data Binop =
63 Binop
63 Binop
64− { _op_name :: N.Name
64+ { _op_name :: Name.Name
65 , _op_annotation :: Can.Annotation
65 , _op_annotation :: Can.Annotation
66 , _op_associativity :: Binop.Associativity
66 , _op_associativity :: Binop.Associativity
67 , _op_precedence :: Binop.Precedence
67 , _op_precedence :: Binop.Precedence
@@ -72,7 +72,7 @@ data Binop =
72-- FROM MODULE
72-- FROM MODULE
73
73
74
74
75−fromModule :: Map.Map N.Name Can.Annotation -> Can.Module -> Interface
75+fromModule :: Map.Map Name.Name Can.Annotation -> Can.Module -> Interface
76fromModule types (Can.Module _ _ exports _ unions aliases binops _) =
76fromModule types (Can.Module _ _ exports _ unions aliases binops _) =
77 Interface
77 Interface
78 { _types = privatize exports types
78 { _types = privatize exports types
@@ -82,7 +82,7 @@ fromModule types (Can.Module _ _ exports _ unions aliases binops _) =
82 }
82 }
83
83
84
84
85−privatize :: Can.Exports -> Map.Map N.Name a -> Map.Map N.Name a
85+privatize :: Can.Exports -> Map.Map Name.Name a -> Map.Map Name.Name a
86privatize exports dict =
86privatize exports dict =
87 case exports of
87 case exports of
88 Can.ExportEverything _ ->
88 Can.ExportEverything _ ->
@@ -92,12 +92,12 @@ privatize exports dict =
92 Map.intersection dict explicitExports
92 Map.intersection dict explicitExports
93
93
94
94
95−toOp :: Map.Map N.Name Can.Annotation -> Can.Binop -> Binop
95+toOp :: Map.Map Name.Name Can.Annotation -> Can.Binop -> Binop
96toOp types (Can.Binop_ associativity precedence name) =
96toOp types (Can.Binop_ associativity precedence name) =
97 Binop name (types ! name) associativity precedence
97 Binop name (types ! name) associativity precedence
98
98
99
99
100−privatizeUnions :: Can.Exports -> Map.Map N.Name Can.Union -> Map.Map N.Name Union
100+privatizeUnions :: Can.Exports -> Map.Map Name.Name Can.Union -> Map.Map Name.Name Union
101privatizeUnions exports unions =
101privatizeUnions exports unions =
102 case exports of
102 case exports of
103 Can.ExportEverything _ ->
103 Can.ExportEverything _ ->
@@ -115,7 +115,7 @@ privatizeUnions exports unions =
115 _ -> error "impossible exports discovered in privatizeUnions"
115 _ -> error "impossible exports discovered in privatizeUnions"
116
116
117
117
118−privatizeAliases :: Can.Exports -> Map.Map N.Name Can.Alias -> Map.Map N.Name Alias
118+privatizeAliases :: Can.Exports -> Map.Map Name.Name Can.Alias -> Map.Map Name.Name Alias
119privatizeAliases exports aliases =
119privatizeAliases exports aliases =
120 case exports of
120 case exports of
121 Can.ExportEverything _ ->
121 Can.ExportEverything _ ->