on master help sign in
Update Canonical/* for collapse of AST.Valid and Reporting.Region
commit1ae4e82154f442b879ef749ed896d45b63584d7c authorEvan Czaplicki <evancz@users.noreply.github.com> dateThu 27 Dec 2018, 11:49 (8 years ago) parentdba8208
8 files changed+156−180
compiler/src/Canonicalize/Effects.hs+18−19 compiler/src/Canonicalize/Environment.hs+16−16 compiler/src/Canonicalize/Environment/Dups.hs+6−7 compiler/src/Canonicalize/Environment/Local.hs+38−40 compiler/src/Canonicalize/Expression.hs+48−50 compiler/src/Canonicalize/Module.hs+23−39 compiler/src/Canonicalize/Pattern.hs+5−6 compiler/src/Canonicalize/Type.hs+2−3
compiler/src/Canonicalize/Effects.hs+18−19
@@ -11,14 +11,13 @@ import qualified Data.Map as Map
1111import qualified Data.Name as Name
1212
1313import qualified AST.Canonical as Can
14−import qualified AST.Valid as Valid
14+import qualified AST.Source as Src
1515import qualified AST.Utils.Type as Type
1616import qualified Canonicalize.Environment as Env
1717import qualified Canonicalize.Type as Type
1818import qualified Elm.ModuleName as ModuleName
1919import qualified Reporting.Annotation as A
2020import qualified Reporting.Error.Canonicalize as Error
21−import qualified Reporting.Region as R
2221import qualified Reporting.Result as Result
2322
2423
@@ -36,38 +35,38 @@ type Result i w a =
3635
3736canonicalize
3837 :: Env.Env
39− -> [A.Located Valid.Decl]
38+ -> [A.Located Src.Value]
4039 -> Map.Map Name.Name union
41− -> Valid.Effects
40+ -> Src.Effects
4241 -> Result i w Can.Effects
43−canonicalize env decls unions effects =
42+canonicalize env values unions effects =
4443 case effects of
45− Valid.NoEffects ->
44+ Src.NoEffects ->
4645 Result.ok Can.NoEffects
4746
48− Valid.Ports ports ->
47+ Src.Ports ports ->
4948 do pairs <- traverse (canonicalizePort env) ports
5049 return $ Can.Ports (Map.fromList pairs)
5150
52− Valid.Manager region manager ->
53− let dict = Map.fromList (map toNameRegion decls) in
51+ Src.Manager region manager ->
52+ let dict = Map.fromList (map toNameRegion values) in
5453 Can.Manager
5554 <$> verifyManager region dict "init"
5655 <*> verifyManager region dict "onEffects"
5756 <*> verifyManager region dict "onSelfMsg"
5857 <*>
5958 case manager of
60− Valid.Cmd cmdType ->
59+ Src.Cmd cmdType ->
6160 Can.Cmd
6261 <$> verifyEffectType cmdType unions
6362 <* verifyManager region dict "cmdMap"
6463
65− Valid.Sub subType ->
64+ Src.Sub subType ->
6665 Can.Sub
6766 <$> verifyEffectType subType unions
6867 <* verifyManager region dict "subMap"
6968
70− Valid.Fx cmdType subType ->
69+ Src.Fx cmdType subType ->
7170 Can.Fx
7271 <$> verifyEffectType cmdType unions
7372 <*> verifyEffectType subType unions
@@ -79,8 +78,8 @@ canonicalize env decls unions effects =
7978-- CANONICALIZE PORT
8079
8180
82−canonicalizePort :: Env.Env -> Valid.Port -> Result i w (Name.Name, Can.Port)
83−canonicalizePort env (Valid.Port (A.At region portName) tipe) =
81+canonicalizePort :: Env.Env -> Src.Port -> Result i w (Name.Name, Can.Port)
82+canonicalizePort env (Src.Port (A.At region portName) tipe) =
8483 do (Can.Forall freeVars ctipe) <- Type.toAnnotation env tipe
8584 case reverse (Type.delambda (Type.deepDealias ctipe)) of
8685 Can.TType home name [msg] : revArgs
@@ -139,14 +138,14 @@ verifyEffectType (A.At region name) unions =
139138 Result.throw (Error.EffectNotFound region name)
140139
141140
142−toNameRegion :: A.Located Valid.Decl -> (Name.Name, R.Region)
143−toNameRegion (A.At _ (Valid.Decl (A.At region name) _ _ _)) =
141+toNameRegion :: A.Located Src.Value -> (Name.Name, A.Region)
142+toNameRegion (A.At _ (Src.Value (A.At region name) _ _ _)) =
144143 (name, region)
145144
146145
147−verifyManager :: R.Region -> Map.Map Name.Name R.Region -> Name.Name -> Result i w R.Region
148−verifyManager tagRegion decls name =
149− case Map.lookup name decls of
146+verifyManager :: A.Region -> Map.Map Name.Name A.Region -> Name.Name -> Result i w A.Region
147+verifyManager tagRegion values name =
148+ case Map.lookup name values of
150149 Just region ->
151150 Result.ok region
152151
compiler/src/Canonicalize/Environment.hs+16−16
@@ -27,8 +27,8 @@ import qualified AST.Utils.Binop as Binop
2727import qualified AST.Canonical as Can
2828import qualified Data.Index as Index
2929import qualified Elm.ModuleName as ModuleName
30+import qualified Reporting.Annotation as A
3031import qualified Reporting.Error.Canonicalize as Error
31−import qualified Reporting.Region as R
3232import qualified Reporting.Result as Result
3333
3434
@@ -70,8 +70,8 @@ type Qualified a =
7070
7171
7272data Var
73− = Local R.Region
74− | TopLevel R.Region
73+ = Local A.Region
74+ | TopLevel A.Region
7575 | Foreign (Map.Map ModuleName.Canonical Can.Annotation)
7676
7777
@@ -118,7 +118,7 @@ data Binop =
118118-- VARIABLE -- ADD LOCALS
119119
120120
121−addLocals :: Map.Map Name.Name R.Region -> Env -> Result i w Env
121+addLocals :: Map.Map Name.Name A.Region -> Env -> Result i w Env
122122addLocals names (Env home vars ts cs bs qvs qts qcs) =
123123 do newVars <-
124124 Map.mergeA
@@ -131,12 +131,12 @@ addLocals names (Env home vars ts cs bs qvs qts qcs) =
131131 Result.ok (Env home newVars ts cs bs qvs qts qcs)
132132
133133
134−addLocalLeft :: Name.Name -> R.Region -> Var
134+addLocalLeft :: Name.Name -> A.Region -> Var
135135addLocalLeft _ region =
136136 Local region
137137
138138
139−addLocalBoth :: Name.Name -> R.Region -> Var -> Result i w Var
139+addLocalBoth :: Name.Name -> A.Region -> Var -> Result i w Var
140140addLocalBoth name region var =
141141 case var of
142142 Foreign _ ->
@@ -153,7 +153,7 @@ addLocalBoth name region var =
153153-- FIND TYPE
154154
155155
156−findType :: R.Region -> Env -> Name.Name -> Result i w Type
156+findType :: A.Region -> Env -> Name.Name -> Result i w Type
157157findType region (Env _ _ ts _ _ _ qts _) name =
158158 case Map.lookup name ts of
159159 Just (I.Bin 1 _ tipe _ _) ->
@@ -166,7 +166,7 @@ findType region (Env _ _ ts _ _ _ qts _) name =
166166 Result.throw (Error.NotFoundType region Nothing name (toPossibleNames ts qts))
167167
168168
169−findTypeQual :: R.Region -> Env -> Name.Name -> Name.Name -> Result i w Type
169+findTypeQual :: A.Region -> Env -> Name.Name -> Name.Name -> Result i w Type
170170findTypeQual region (Env _ _ ts _ _ _ qts _) prefix name =
171171 case Map.lookup prefix qts of
172172 Just qualified ->
@@ -188,20 +188,20 @@ findTypeQual region (Env _ _ ts _ _ _ qts _) prefix name =
188188-- FIND CTOR
189189
190190
191−findCtor :: R.Region -> Env -> Name.Name -> Result i w Ctor
191+findCtor :: A.Region -> Env -> Name.Name -> Result i w Ctor
192192findCtor region (Env _ _ _ cs _ _ _ qcs) name =
193193 case Map.lookup name cs of
194194 Just (I.Bin 1 _ ctor _ _) ->
195195 Result.ok ctor
196196
197197 Just homes ->
198− Result.throw (Error.AmbiguousCtor region Nothing name (Map.keys homes))
198+ Result.throw (Error.AmbiguousVariant region Nothing name (Map.keys homes))
199199
200200 Nothing ->
201− Result.throw (Error.NotFoundCtor region Nothing name (toPossibleNames cs qcs))
201+ Result.throw (Error.NotFoundVariant region Nothing name (toPossibleNames cs qcs))
202202
203203
204−findCtorQual :: R.Region -> Env -> Name.Name -> Name.Name -> Result i w Ctor
204+findCtorQual :: A.Region -> Env -> Name.Name -> Name.Name -> Result i w Ctor
205205findCtorQual region (Env _ _ _ cs _ _ _ qcs) prefix name =
206206 case Map.lookup prefix qcs of
207207 Just qualified ->
@@ -210,20 +210,20 @@ findCtorQual region (Env _ _ _ cs _ _ _ qcs) prefix name =
210210 Result.ok pattern
211211
212212 Just homes ->
213− Result.throw (Error.AmbiguousCtor region (Just prefix) name (Map.keys homes))
213+ Result.throw (Error.AmbiguousVariant region (Just prefix) name (Map.keys homes))
214214
215215 Nothing ->
216− Result.throw (Error.NotFoundCtor region (Just prefix) name (toPossibleNames cs qcs))
216+ Result.throw (Error.NotFoundVariant region (Just prefix) name (toPossibleNames cs qcs))
217217
218218 Nothing ->
219− Result.throw (Error.NotFoundCtor region (Just prefix) name (toPossibleNames cs qcs))
219+ Result.throw (Error.NotFoundVariant region (Just prefix) name (toPossibleNames cs qcs))
220220
221221
222222
223223-- FIND BINOP
224224
225225
226−findBinop :: R.Region -> Env -> Name.Name -> Result i w Binop
226+findBinop :: A.Region -> Env -> Name.Name -> Result i w Binop
227227findBinop region (Env _ _ _ _ binops _ _ _) name =
228228 case Map.lookup name binops of
229229 Just (I.Bin 1 _ binop _ _) ->
compiler/src/Canonicalize/Environment/Dups.hs+6−7
@@ -20,7 +20,6 @@ import qualified Data.Name as Name
2020import qualified Data.OneOrMore as OneOrMore
2121import qualified Reporting.Annotation as A
2222import qualified Reporting.Error.Canonicalize as Error
23−import qualified Reporting.Region as R
2423import qualified Reporting.Result as Result
2524
2625
@@ -34,7 +33,7 @@ type Dict value =
3433
3534data Info value =
3635 Info
37− { _region :: R.Region
36+ { _region :: A.Region
3837 , _value :: value
3938 }
4039
@@ -44,7 +43,7 @@ data Info value =
4443
4544
4645type ToError =
47− Name.Name -> R.Region -> R.Region -> Error.Error
46+ Name.Name -> A.Region -> A.Region -> Error.Error
4847
4948
5049detect :: ToError -> Dict a -> Result.Result i w Error.Error (Map.Map Name.Name a)
@@ -77,12 +76,12 @@ addField (A.At region name, value) dups =
7776 Map.insertWith OneOrMore.more name (OneOrMore.one (Info region value)) dups
7877
7978
80−checkFields' :: (R.Region -> a -> b) -> [(A.Located Name.Name, a)] -> Result.Result i w Error.Error (Map.Map Name.Name b)
79+checkFields' :: (A.Region -> a -> b) -> [(A.Located Name.Name, a)] -> Result.Result i w Error.Error (Map.Map Name.Name b)
8180checkFields' toValue fields =
8281 detect Error.DuplicateField (foldr (addField' toValue) none fields)
8382
8483
85−addField' :: (R.Region -> a -> b) -> (A.Located Name.Name, a) -> Dict b -> Dict b
84+addField' :: (A.Region -> a -> b) -> (A.Located Name.Name, a) -> Dict b -> Dict b
8685addField' toValue (A.At region name, value) dups =
8786 Map.insertWith OneOrMore.more name (OneOrMore.one (Info region (toValue region value))) dups
8887
@@ -96,12 +95,12 @@ none =
9695 Map.empty
9796
9897
99−one :: Name.Name -> R.Region -> value -> Dict value
98+one :: Name.Name -> A.Region -> value -> Dict value
10099one name region value =
101100 Map.singleton name (OneOrMore.one (Info region value))
102101
103102
104−insert :: Name.Name -> R.Region -> a -> Dict a -> Dict a
103+insert :: Name.Name -> A.Region -> a -> Dict a -> Dict a
105104insert name region value dict =
106105 Map.insertWith OneOrMore.more name (OneOrMore.one (Info region value)) dict
107106
compiler/src/Canonicalize/Environment/Local.hs+38−40
@@ -14,7 +14,6 @@ import qualified Data.Name as Name
1414
1515import qualified AST.Canonical as Can
1616import qualified AST.Source as Src
17−import qualified AST.Valid as Valid
1817import qualified Canonicalize.Environment as Env
1918import qualified Canonicalize.Environment.Dups as Dups
2019import qualified Canonicalize.Type as Type
@@ -22,7 +21,6 @@ import qualified Data.Index as Index
2221import qualified Elm.ModuleName as ModuleName
2322import qualified Reporting.Annotation as A
2423import qualified Reporting.Error.Canonicalize as Error
25−import qualified Reporting.Region as R
2624import qualified Reporting.Result as Result
2725
2826
@@ -38,7 +36,7 @@ type Unions = Map.Map Name.Name Can.Union
3836type Aliases = Map.Map Name.Name Can.Alias
3937
4038
41−add :: Valid.Module -> Env.Env -> Result i w (Env.Env, Unions, Aliases)
39+add :: Src.Module -> Env.Env -> Result i w (Env.Env, Unions, Aliases)
4240add module_ env =
4341 addCtors module_ =<< addVars module_ =<< addTypes module_ env
4442
@@ -47,7 +45,7 @@ add module_ env =
4745-- ADD VARS
4846
4947
50−addVars :: Valid.Module -> Env.Env -> Result i w Env.Env
48+addVars :: Src.Module -> Env.Env -> Result i w Env.Env
5149addVars module_ (Env.Env home vs ts cs bs qvs qts qcs) =
5250 do topLevelVars <- collectVars module_
5351 let vs2 = Map.union topLevelVars vs
@@ -55,38 +53,38 @@ addVars module_ (Env.Env home vs ts cs bs qvs qts qcs) =
5553 Result.ok $ Env.Env home vs2 ts cs bs qvs qts qcs
5654
5755
58−collectVars :: Valid.Module -> Result i w (Map.Map Name.Name Env.Var)
59−collectVars (Valid.Module _ _ _ _ _ decls _ _ _ effects) =
56+collectVars :: Src.Module -> Result i w (Map.Map Name.Name Env.Var)
57+collectVars (Src.Module _ _ _ values _ _ _ effects) =
6058 let
61− addDecl dict (A.At _ (Valid.Decl (A.At region name) _ _ _)) =
59+ addDecl dict (A.At _ (Src.Value (A.At region name) _ _ _)) =
6260 Dups.insert name region (Env.TopLevel region) dict
6361 in
6462 Dups.detect Error.DuplicateDecl $
65− List.foldl' addDecl (toEffectDups effects) decls
63+ List.foldl' addDecl (toEffectDups effects) values
6664
6765
68−toEffectDups :: Valid.Effects -> Dups.Dict Env.Var
66+toEffectDups :: Src.Effects -> Dups.Dict Env.Var
6967toEffectDups effects =
7068 case effects of
71− Valid.NoEffects ->
69+ Src.NoEffects ->
7270 Dups.none
7371
74− Valid.Ports ports ->
72+ Src.Ports ports ->
7573 let
76− addPort dict (Valid.Port (A.At region name) _) =
74+ addPort dict (Src.Port (A.At region name) _) =
7775 Dups.insert name region (Env.TopLevel region) dict
7876 in
7977 List.foldl' addPort Dups.none ports
8078
81− Valid.Manager _ manager ->
79+ Src.Manager _ manager ->
8280 case manager of
83− Valid.Cmd (A.At region _) ->
81+ Src.Cmd (A.At region _) ->
8482 Dups.one "command" region (Env.TopLevel region)
8583
86− Valid.Sub (A.At region _) ->
84+ Src.Sub (A.At region _) ->
8785 Dups.one "subscription" region (Env.TopLevel region)
8886
89− Valid.Fx (A.At regionCmd _) (A.At regionSub _) ->
87+ Src.Fx (A.At regionCmd _) (A.At regionSub _) ->
9088 Dups.union
9189 (Dups.one "command" regionCmd (Env.TopLevel regionCmd))
9290 (Dups.one "subscription" regionSub (Env.TopLevel regionSub))
@@ -96,11 +94,11 @@ toEffectDups effects =
9694-- ADD TYPES
9795
9896
99−addTypes :: Valid.Module -> Env.Env -> Result i w Env.Env
100−addTypes (Valid.Module _ _ _ _ _ _ unions aliases _ _) (Env.Env home vs ts cs bs qvs qts qcs) =
97+addTypes :: Src.Module -> Env.Env -> Result i w Env.Env
98+addTypes (Src.Module _ _ _ _ unions aliases _ _) (Env.Env home vs ts cs bs qvs qts qcs) =
10199 let
102− addAliasDups dups (Valid.Alias _ (A.At region name) _ _) = Dups.insert name region () dups
103− addUnionDups dups (Valid.Union _ (A.At region name) _ _) = Dups.insert name region () dups
100+ addAliasDups dups (A.At _ (Src.Alias (A.At region name) _ _)) = Dups.insert name region () dups
101+ addUnionDups dups (A.At _ (Src.Union (A.At region name) _ _)) = Dups.insert name region () dups
104102 typeNameDups =
105103 List.foldl' addUnionDups (List.foldl' addAliasDups Dups.none aliases) unions
106104 in
@@ -109,8 +107,8 @@ addTypes (Valid.Module _ _ _ _ _ _ unions aliases _ _) (Env.Env home vs ts cs bs
109107 addAliases aliases (Env.Env home vs ts1 cs bs qvs qts qcs)
110108
111109
112−addUnion :: ModuleName.Canonical -> Env.Exposed Env.Type -> Valid.Union -> Result i w (Env.Exposed Env.Type)
113−addUnion home types union@(Valid.Union _ (A.At _ name) _ _) =
110+addUnion :: ModuleName.Canonical -> Env.Exposed Env.Type -> A.Located Src.Union -> Result i w (Env.Exposed Env.Type)
111+addUnion home types union@(A.At _ (Src.Union (A.At _ name) _ _)) =
114112 do arity <- checkUnionFreeVars union
115113 let one = Map.singleton home (Env.Union arity home)
116114 Result.ok $ Map.insert name one types
@@ -120,7 +118,7 @@ addUnion home types union@(Valid.Union _ (A.At _ name) _ _) =
120118-- ADD TYPE ALIASES
121119
122120
123−addAliases :: [Valid.Alias] -> Env.Env -> Result i w Env.Env
121+addAliases :: [A.Located Src.Alias] -> Env.Env -> Result i w Env.Env
124122addAliases aliases env =
125123 let
126124 nodes = map toNode aliases
@@ -129,10 +127,10 @@ addAliases aliases env =
129127 foldM addAlias env sccs
130128
131129
132−addAlias :: Env.Env -> Graph.SCC Valid.Alias -> Result i w Env.Env
130+addAlias :: Env.Env -> Graph.SCC (A.Located Src.Alias) -> Result i w Env.Env
133131addAlias env@(Env.Env home vs ts cs bs qvs qts qcs) scc =
134132 case scc of
135− Graph.AcyclicSCC alias@(Valid.Alias _ (A.At _ name) _ tipe) ->
133+ Graph.AcyclicSCC alias@(A.At _ (Src.Alias (A.At _ name) _ tipe)) ->
136134 do args <- checkAliasFreeVars alias
137135 ctype <- Type.canonicalize env tipe
138136 let one = Map.singleton home (Env.Alias (length args) home args ctype)
@@ -142,9 +140,9 @@ addAlias env@(Env.Env home vs ts cs bs qvs qts qcs) scc =
142140 Graph.CyclicSCC [] ->
143141 Result.ok env
144142
145− Graph.CyclicSCC (alias@(Valid.Alias _ (A.At region name1) _ tipe) : others) ->
143+ Graph.CyclicSCC (alias@(A.At _ (Src.Alias (A.At region name1) _ tipe)) : others) ->
146144 do args <- checkAliasFreeVars alias
147− let toName (Valid.Alias _ (A.At _ name) _ _) = name
145+ let toName (A.At _ (Src.Alias (A.At _ name) _ _)) = name
148146 Result.throw (Error.RecursiveAlias region name1 args tipe (map toName others))
149147
150148
@@ -152,8 +150,8 @@ addAlias env@(Env.Env home vs ts cs bs qvs qts qcs) scc =
152150-- DETECT TYPE ALIAS CYCLES
153151
154152
155−toNode :: Valid.Alias -> (Valid.Alias, Name.Name, [Name.Name])
156−toNode alias@(Valid.Alias _ (A.At _ name) _ tipe) =
153+toNode :: A.Located Src.Alias -> (A.Located Src.Alias, Name.Name, [Name.Name])
154+toNode alias@(A.At _ (Src.Alias (A.At _ name) _ tipe)) =
157155 ( alias, name, getEdges [] tipe )
158156
159157
@@ -186,8 +184,8 @@ getEdges edges (A.At _ tipe) =
186184-- CHECK FREE VARIABLES
187185
188186
189−checkUnionFreeVars :: Valid.Union -> Result i w Int
190−checkUnionFreeVars (Valid.Union unionRegion (A.At _ name) args ctors) =
187+checkUnionFreeVars :: A.Located Src.Union -> Result i w Int
188+checkUnionFreeVars (A.At unionRegion (Src.Union (A.At _ name) args ctors)) =
191189 let
192190 addArg (A.At region arg) dict =
193191 Dups.insert arg region region dict
@@ -206,8 +204,8 @@ checkUnionFreeVars (Valid.Union unionRegion (A.At _ name) args ctors) =
206204 Error.TypeVarsUnboundInUnion unionRegion name (map A.toValue args) unbound unbounds
207205
208206
209−checkAliasFreeVars :: Valid.Alias -> Result i w [Name.Name]
210−checkAliasFreeVars (Valid.Alias aliasRegion (A.At _ name) args tipe) =
207+checkAliasFreeVars :: A.Located Src.Alias -> Result i w [Name.Name]
208+checkAliasFreeVars (A.At aliasRegion (Src.Alias (A.At _ name) args tipe)) =
211209 let
212210 addArg (A.At region arg) dict =
213211 Dups.insert arg region region dict
@@ -225,7 +223,7 @@ checkAliasFreeVars (Valid.Alias aliasRegion (A.At _ name) args tipe) =
225223 (Map.toList (Map.difference freeVars boundVars))
226224
227225
228−addFreeVars :: Map.Map Name.Name R.Region -> Src.Type -> Map.Map Name.Name R.Region
226+addFreeVars :: Map.Map Name.Name A.Region -> Src.Type -> Map.Map Name.Name A.Region
229227addFreeVars freeVars (A.At region tipe) =
230228 case tipe of
231229 Src.TLambda arg result ->
@@ -263,8 +261,8 @@ addFreeVars freeVars (A.At region tipe) =
263261-- ADD CTORS
264262
265263
266−addCtors :: Valid.Module -> Env.Env -> Result i w (Env.Env, Unions, Aliases)
267−addCtors (Valid.Module _ _ _ _ _ _ unions aliases _ _) env@(Env.Env home vs ts cs bs qvs qts qcs) =
264+addCtors :: Src.Module -> Env.Env -> Result i w (Env.Env, Unions, Aliases)
265+addCtors (Src.Module _ _ _ _ unions aliases _ _) env@(Env.Env home vs ts cs bs qvs qts qcs) =
268266 do unionInfo <- traverse (canonicalizeUnion env) unions
269267 aliasInfo <- traverse (canonicalizeAlias env) aliases
270268
@@ -290,8 +288,8 @@ type CtorDups = Dups.Dict (Map.Map ModuleName.Canonical Env.Ctor)
290288-- CANONICALIZE ALIAS
291289
292290
293−canonicalizeAlias :: Env.Env -> Valid.Alias -> Result i w ( (Name.Name, Can.Alias), CtorDups )
294−canonicalizeAlias env@(Env.Env home _ _ _ _ _ _ _) (Valid.Alias _ (A.At region name) args tipe) =
291+canonicalizeAlias :: Env.Env -> A.Located Src.Alias -> Result i w ( (Name.Name, Can.Alias), CtorDups )
292+canonicalizeAlias env@(Env.Env home _ _ _ _ _ _ _) (A.At _ (Src.Alias (A.At region name) args tipe)) =
295293 do let vars = map A.toValue args
296294 ctipe <- Type.canonicalize env tipe
297295 Result.ok
@@ -322,8 +320,8 @@ toRecordCtor home name vars fields =
322320-- CANONICALIZE UNION
323321
324322
325−canonicalizeUnion :: Env.Env -> Valid.Union -> Result i w ( (Name.Name, Can.Union), CtorDups )
326−canonicalizeUnion env@(Env.Env home _ _ _ _ _ _ _) (Valid.Union _ (A.At _ name) avars ctors) =
323+canonicalizeUnion :: Env.Env -> A.Located Src.Union -> Result i w ( (Name.Name, Can.Union), CtorDups )
324+canonicalizeUnion env@(Env.Env home _ _ _ _ _ _ _) (A.At _ (Src.Union (A.At _ name) avars ctors)) =
327325 do cctors <- Index.indexedTraverse (canonicalizeCtor env) ctors
328326 let vars = map A.toValue avars
329327 let alts = map A.toValue cctors
compiler/src/Canonicalize/Expression.hs+48−50
@@ -21,7 +21,6 @@ import qualified AST.Canonical as Can
2121import qualified AST.Source as Src
2222import qualified AST.Utils.Binop as Binop
2323import qualified AST.Utils.Type as Type
24−import qualified AST.Valid as Valid
2524import qualified Canonicalize.Environment as Env
2625import qualified Canonicalize.Environment.Dups as Dups
2726import qualified Canonicalize.Pattern as Pattern
@@ -31,7 +30,6 @@ import qualified Elm.ModuleName as ModuleName
3130import qualified Elm.Package as Pkg
3231import qualified Reporting.Annotation as A
3332import qualified Reporting.Error.Canonicalize as Error
34−import qualified Reporting.Region as R
3533import qualified Reporting.Result as Result
3634import qualified Reporting.Warning as W
3735
@@ -59,46 +57,46 @@ data Uses =
5957-- CANONICALIZE
6058
6159
62−canonicalize :: Env.Env -> Valid.Expr -> Result FreeLocals [W.Warning] Can.Expr
60+canonicalize :: Env.Env -> Src.Expr -> Result FreeLocals [W.Warning] Can.Expr
6361canonicalize env (A.At region expression) =
6462 A.At region <$>
6563 case expression of
66− Valid.Str string ->
64+ Src.Str string ->
6765 Result.ok (Can.Str string)
6866
69− Valid.Chr char ->
67+ Src.Chr char ->
7068 Result.ok (Can.Chr char)
7169
72− Valid.Int int ->
70+ Src.Int int ->
7371 Result.ok (Can.Int int)
7472
75− Valid.Float float ->
73+ Src.Float float ->
7674 Result.ok (Can.Float float)
7775
78− Valid.Var varType name ->
76+ Src.Var varType name ->
7977 case varType of
80− Src.Value -> findVar region env name
81− Src.Ctor -> toVarCtor name <$> Env.findCtor region env name
78+ Src.LowVar -> findVar region env name
79+ Src.CapVar -> toVarCtor name <$> Env.findCtor region env name
8280
83− Valid.VarQual varType prefix name ->
81+ Src.VarQual varType prefix name ->
8482 case varType of
85− Src.Value -> findVarQual region env prefix name
86− Src.Ctor -> toVarCtor name <$> Env.findCtorQual region env prefix name
83+ Src.LowVar -> findVarQual region env prefix name
84+ Src.CapVar -> toVarCtor name <$> Env.findCtorQual region env prefix name
8785
88− Valid.List exprs ->
86+ Src.List exprs ->
8987 Can.List <$> traverse (canonicalize env) exprs
9088
91− Valid.Op op ->
89+ Src.Op op ->
9290 do (Env.Binop _ home name annotation _ _) <- Env.findBinop region env op
9391 return (Can.VarOperator op home name annotation)
9492
95− Valid.Negate expr ->
93+ Src.Negate expr ->
9694 Can.Negate <$> canonicalize env expr
9795
98− Valid.Binops ops final ->
96+ Src.Binops ops final ->
9997 A.toValue <$> canonicalizeBinops region env ops final
10098
101− Valid.Lambda srcArgs body ->
99+ Src.Lambda srcArgs body ->
102100 delayedUsage $
103101 do (args, bindings) <-
104102 Pattern.verify Error.DPLambdaArgs $
@@ -112,33 +110,33 @@ canonicalize env (A.At region expression) =
112110
113111 return (Can.Lambda args cbody, freeLocals)
114112
115− Valid.Call func args ->
113+ Src.Call func args ->
116114 Can.Call
117115 <$> canonicalize env func
118116 <*> traverse (canonicalize env) args
119117
120− Valid.If branches finally ->
118+ Src.If branches finally ->
121119 Can.If
122120 <$> traverse (canonicalizeIfBranch env) branches
123121 <*> canonicalize env finally
124122
125− Valid.Let defs expr ->
123+ Src.Let defs expr ->
126124 A.toValue <$> canonicalizeLet region env defs expr
127125
128− Valid.Case expr branches ->
126+ Src.Case expr branches ->
129127 Can.Case
130128 <$> canonicalize env expr
131129 <*> traverse (canonicalizeCaseBranch env) branches
132130
133− Valid.Accessor field ->
131+ Src.Accessor field ->
134132 Result.ok $ Can.Accessor field
135133
136− Valid.Access record field ->
134+ Src.Access record field ->
137135 Can.Access
138136 <$> canonicalize env record
139137 <*> Result.ok field
140138
141− Valid.Update (A.At reg name) fields ->
139+ Src.Update (A.At reg name) fields ->
142140 let
143141 makeCanFields =
144142 Dups.checkFields' (\r t -> Can.FieldUpdate r <$> canonicalize env t) fields
@@ -147,28 +145,28 @@ canonicalize env (A.At region expression) =
147145 <$> (A.At reg <$> findVar reg env name)
148146 <*> (sequenceA =<< makeCanFields)
149147
150− Valid.Record fields ->
148+ Src.Record fields ->
151149 do fieldDict <- Dups.checkFields fields
152150 Can.Record <$> traverse (canonicalize env) fieldDict
153151
154− Valid.Unit ->
152+ Src.Unit ->
155153 Result.ok Can.Unit
156154
157− Valid.Tuple a b cs ->
155+ Src.Tuple a b cs ->
158156 Can.Tuple
159157 <$> canonicalize env a
160158 <*> canonicalize env b
161159 <*> canonicalizeTupleExtras region env cs
162160
163− Valid.Shader uid src tipe ->
164− Result.ok (Can.Shader uid src tipe)
161+ Src.Shader src tipe ->
162+ Result.ok (Can.Shader src tipe)
165163
166164
167165
168166-- CANONICALIZE TUPLE EXTRAS
169167
170168
171−canonicalizeTupleExtras :: R.Region -> Env.Env -> [Valid.Expr] -> Result FreeLocals [W.Warning] (Maybe Can.Expr)
169+canonicalizeTupleExtras :: A.Region -> Env.Env -> [Src.Expr] -> Result FreeLocals [W.Warning] (Maybe Can.Expr)
172170canonicalizeTupleExtras region env extras =
173171 case extras of
174172 [] ->
@@ -185,7 +183,7 @@ canonicalizeTupleExtras region env extras =
185183-- CANONICALIZE IF BRANCH
186184
187185
188−canonicalizeIfBranch :: Env.Env -> (Valid.Expr, Valid.Expr) -> Result FreeLocals [W.Warning] (Can.Expr, Can.Expr)
186+canonicalizeIfBranch :: Env.Env -> (Src.Expr, Src.Expr) -> Result FreeLocals [W.Warning] (Can.Expr, Can.Expr)
189187canonicalizeIfBranch env (condition, branch) =
190188 (,)
191189 <$> canonicalize env condition
@@ -196,7 +194,7 @@ canonicalizeIfBranch env (condition, branch) =
196194-- CANONICALIZE CASE BRANCH
197195
198196
199−canonicalizeCaseBranch :: Env.Env -> (Src.Pattern, Valid.Expr) -> Result FreeLocals [W.Warning] Can.CaseBranch
197+canonicalizeCaseBranch :: Env.Env -> (Src.Pattern, Src.Expr) -> Result FreeLocals [W.Warning] Can.CaseBranch
200198canonicalizeCaseBranch env (pattern, expr) =
201199 directUsage $
202200 do (cpattern, bindings) <-
@@ -214,7 +212,7 @@ canonicalizeCaseBranch env (pattern, expr) =
214212-- CANONICALIZE BINOPS
215213
216214
217−canonicalizeBinops :: R.Region -> Env.Env -> [(Valid.Expr, A.Located Name.Name)] -> Valid.Expr -> Result FreeLocals [W.Warning] Can.Expr
215+canonicalizeBinops :: A.Region -> Env.Env -> [(Src.Expr, A.Located Name.Name)] -> Src.Expr -> Result FreeLocals [W.Warning] Can.Expr
218216canonicalizeBinops overallRegion env ops final =
219217 let
220218 canonicalizeHelp (expr, A.At region op) =
@@ -235,7 +233,7 @@ data Step
235233 | Error Env.Binop Env.Binop
236234
237235
238−runBinopStepper :: R.Region -> Step -> Result FreeLocals w Can.Expr
236+runBinopStepper :: A.Region -> Step -> Result FreeLocals w Can.Expr
239237runBinopStepper overallRegion step =
240238 case step of
241239 Done expr ->
@@ -297,7 +295,7 @@ toBinop (Env.Binop op home name annotation _ _) left right =
297295-- CANONICALIZE LET
298296
299297
300−canonicalizeLet :: R.Region -> Env.Env -> [Valid.Def] -> Valid.Expr -> Result FreeLocals [W.Warning] Can.Expr
298+canonicalizeLet :: A.Region -> Env.Env -> [A.Located Src.Def] -> Src.Expr -> Result FreeLocals [W.Warning] Can.Expr
301299canonicalizeLet letRegion env defs body =
302300 directUsage $
303301 do bindings <-
@@ -316,17 +314,17 @@ canonicalizeLet letRegion env defs body =
316314-- ADD BINDINGS
317315
318316
319−addBindings :: Dups.Dict R.Region -> Valid.Def -> Dups.Dict R.Region
320−addBindings bindings def =
317+addBindings :: Dups.Dict A.Region -> A.Located Src.Def -> Dups.Dict A.Region
318+addBindings bindings (A.At _ def) =
321319 case def of
322− Valid.Define _ (A.At region name) _ _ _ ->
320+ Src.Define (A.At region name) _ _ _ ->
323321 Dups.insert name region region bindings
324322
325− Valid.Destruct _ pattern _ ->
323+ Src.Destruct pattern _ ->
326324 addBindingsHelp bindings pattern
327325
328326
329−addBindingsHelp :: Dups.Dict R.Region -> Src.Pattern -> Dups.Dict R.Region
327+addBindingsHelp :: Dups.Dict A.Region -> Src.Pattern -> Dups.Dict A.Region
330328addBindingsHelp bindings (A.At region pattern) =
331329 case pattern of
332330 Src.PAnything ->
@@ -388,10 +386,10 @@ data Binding
388386 | Destruct Can.Pattern Can.Expr
389387
390388
391−addDefNodes :: Env.Env -> [Node] -> Valid.Def -> Result FreeLocals [W.Warning] [Node]
392−addDefNodes env nodes def =
389+addDefNodes :: Env.Env -> [Node] -> A.Located Src.Def -> Result FreeLocals [W.Warning] [Node]
390+addDefNodes env nodes (A.At _ def) =
393391 case def of
394− Valid.Define _ aname@(A.At _ name) srcArgs body maybeType ->
392+ Src.Define aname@(A.At _ name) srcArgs body maybeType ->
395393 case maybeType of
396394 Nothing ->
397395 do (args, argBindings) <-
@@ -424,7 +422,7 @@ addDefNodes env nodes def =
424422 let node = ( Define cdef, name, Map.keys freeLocals )
425423 logLetLocals args freeLocals (node:nodes)
426424
427− Valid.Destruct _ pattern body ->
425+ Src.Destruct pattern body ->
428426 do (cpattern, _bindings) <-
429427 Pattern.verify Error.DPDestruct $
430428 Pattern.canonicalize env pattern
@@ -512,14 +510,14 @@ gatherTypedArgs env name srcArgs tipe index revTypedArgs =
512510 _ ->
513511 let (A.At start _, A.At end _) = (head srcArgs, last srcArgs) in
514512 Result.throw $
515− Error.AnnotationTooShort (R.merge start end) name index (length srcArgs)
513+ Error.AnnotationTooShort (A.mergeRegions start end) name index (length srcArgs)
516514
517515
518516
519517-- DETECT CYCLES
520518
521519
522−detectCycles :: R.Region -> [Graph.SCC Binding] -> Can.Expr -> Result i w Can.Expr
520+detectCycles :: A.Region -> [Graph.SCC Binding] -> Can.Expr -> Result i w Can.Expr
523521detectCycles letRegion sccs body =
524522 case sccs of
525523 [] ->
@@ -657,7 +655,7 @@ verifyBindings context bindings (Result.Result k) =
657655 )
658656
659657
660−addUnusedWarning :: W.Context -> [W.Warning] -> Name.Name -> R.Region -> [W.Warning]
658+addUnusedWarning :: W.Context -> [W.Warning] -> Name.Name -> A.Region -> [W.Warning]
661659addUnusedWarning context warnings name region =
662660 W.UnusedVariable region context name : warnings
663661
@@ -687,7 +685,7 @@ delayedUsage (Result.Result k) =
687685-- FIND VARIABLE
688686
689687
690−findVar :: R.Region -> Env.Env -> Name.Name -> Result FreeLocals w Can.Expr_
688+findVar :: A.Region -> Env.Env -> Name.Name -> Result FreeLocals w Can.Expr_
691689findVar region (Env.Env localHome vs _ _ _ qvs _ _) name =
692690 case Map.lookup name vs of
693691 Just var ->
@@ -712,7 +710,7 @@ findVar region (Env.Env localHome vs _ _ _ qvs _ _) name =
712710 Result.throw (Error.NotFoundVar region Nothing name (toPossibleNames vs qvs))
713711
714712
715−findVarQual :: R.Region -> Env.Env -> Name.Name -> Name.Name -> Result FreeLocals w Can.Expr_
713+findVarQual :: A.Region -> Env.Env -> Name.Name -> Name.Name -> Result FreeLocals w Can.Expr_
716714findVarQual region (Env.Env localHome vs _ _ _ qvs _ _) prefix name =
717715 case Map.lookup prefix qvs of
718716 Just qualified ->
compiler/src/Canonicalize/Module.hs+23−39
@@ -11,7 +11,6 @@ import qualified Data.Name as Name
1111
1212import qualified AST.Canonical as Can
1313import qualified AST.Source as Src
14−import qualified AST.Valid as Valid
1514import qualified Canonicalize.Effects as Effects
1615import qualified Canonicalize.Environment as Env
1716import qualified Canonicalize.Environment.Dups as Dups
@@ -26,7 +25,6 @@ import qualified Elm.ModuleName as ModuleName
2625import qualified Elm.Package as Pkg
2726import qualified Reporting.Annotation as A
2827import qualified Reporting.Error.Canonicalize as Error
29−import qualified Reporting.Region as R
3028import qualified Reporting.Result as Result
3129import qualified Reporting.Warning as W
3230
@@ -47,9 +45,9 @@ canonicalize
4745 :: Pkg.Name
4846 -> Map.Map Name.Name ModuleName.Canonical
4947 -> I.Interfaces
50− -> Valid.Module
48+ -> Src.Module
5149 -> Result i [W.Warning] Can.Module
52−canonicalize pkg importDict interfaces module_@(Valid.Module name _ _ exports imports decls _ _ binops effects) =
50+canonicalize pkg importDict interfaces module_@(Src.Module name exports imports values _ _ binops effects) =
5351 do let home = ModuleName.Canonical pkg name
5452 let cbinops = Map.fromList (map canonicalizeBinop binops)
5553
@@ -57,33 +55,19 @@ canonicalize pkg importDict interfaces module_@(Valid.Module name _ _ exports im
5755 Local.add module_ =<<
5856 Foreign.createInitialEnv home importDict interfaces imports
5957
60− cdecls <- canonicalizeDecls env decls
61− ceffects <- Effects.canonicalize env decls cunions effects
62− cexports <- canonicalizeExports decls cunions caliases cbinops ceffects exports
58+ cvalues <- canonicalizeValues env values
59+ ceffects <- Effects.canonicalize env values cunions effects
60+ cexports <- canonicalizeExports values cunions caliases cbinops ceffects exports
6361
64− return $ Can.Module home (toDocs module_) cexports cdecls cunions caliases cbinops ceffects
65−
66−
67−
68−-- DOCUMENTATION
69−
70−
71−toDocs :: Valid.Module -> Can.Docs
72−toDocs (Valid.Module _ docs comments _ _ _ _ _ _ _) =
73− case docs of
74− Src.NoDocs region ->
75− Can.NoDocs region
76−
77− Src.YesDocs region overview ->
78− Can.YesDocs region overview comments
62+ return $ Can.Module home cexports cvalues cunions caliases cbinops ceffects
7963
8064
8165
8266-- CANONICALIZE BINOP
8367
8468
85−canonicalizeBinop :: Valid.Binop -> ( Name.Name, Can.Binop )
86−canonicalizeBinop (Valid.Binop op associativity precedence func) =
69+canonicalizeBinop :: A.Located Src.Binop -> ( Name.Name, Can.Binop )
70+canonicalizeBinop (A.At _ (Src.Binop op associativity precedence func)) =
8771 ( op, Can.Binop_ associativity precedence func )
8872
8973
@@ -97,9 +81,9 @@ canonicalizeBinop (Valid.Binop op associativity precedence func) =
9781--
9882
9983
100−canonicalizeDecls :: Env.Env -> [A.Located Valid.Decl] -> Result i [W.Warning] Can.Decls
101−canonicalizeDecls env decls =
102− do nodes <- traverse (toNodeOne env) decls
84+canonicalizeValues :: Env.Env -> [A.Located Src.Value] -> Result i [W.Warning] Can.Decls
85+canonicalizeValues env values =
86+ do nodes <- traverse (toNodeOne env) values
10387 detectCycles (Graph.stronglyConnComp nodes)
10488
10589
@@ -151,8 +135,8 @@ type NodeTwo =
151135 (Can.Def, Name.Name, [Name.Name])
152136
153137
154−toNodeOne :: Env.Env -> A.Located Valid.Decl -> Result i [W.Warning] NodeOne
155−toNodeOne env (A.At _ (Valid.Decl aname@(A.At _ name) srcArgs body maybeType)) =
138+toNodeOne :: Env.Env -> A.Located Src.Value -> Result i [W.Warning] NodeOne
139+toNodeOne env (A.At _ (Src.Value aname@(A.At _ name) srcArgs body maybeType)) =
156140 case maybeType of
157141 Nothing ->
158142 do (args, argBindings) <-
@@ -216,41 +200,41 @@ addDirects name (Expr.Uses directUses _) directDeps =
216200
217201
218202canonicalizeExports
219− :: [A.Located Valid.Decl]
203+ :: [A.Located Src.Value]
220204 -> Map.Map Name.Name union
221205 -> Map.Map Name.Name alias
222206 -> Map.Map Name.Name binop
223207 -> Can.Effects
224208 -> A.Located Src.Exposing
225209 -> Result i w Can.Exports
226−canonicalizeExports decls unions aliases binops effects (A.At region exposing) =
210+canonicalizeExports values unions aliases binops effects (A.At region exposing) =
227211 case exposing of
228212 Src.Open ->
229213 Result.ok (Can.ExportEverything region)
230214
231215 Src.Explicit exposeds ->
232− do let names = Map.fromList (map declToName decls)
216+ do let names = Map.fromList (map valueToName values)
233217 infos <- traverse (checkExposed names unions aliases binops effects) exposeds
234218 Can.Export <$> Dups.detect Error.ExportDuplicate (Dups.unions infos)
235219
236220
237−declToName :: A.Located Valid.Decl -> ( Name.Name, () )
238−declToName (A.At _ (Valid.Decl (A.At _ name) _ _ _)) =
221+valueToName :: A.Located Src.Value -> ( Name.Name, () )
222+valueToName (A.At _ (Src.Value (A.At _ name) _ _ _)) =
239223 ( name, () )
240224
241225
242226checkExposed
243− :: Map.Map Name.Name decl
227+ :: Map.Map Name.Name value
244228 -> Map.Map Name.Name union
245229 -> Map.Map Name.Name alias
246230 -> Map.Map Name.Name binop
247231 -> Can.Effects
248232 -> A.Located Src.Exposed
249233 -> Result i w (Dups.Dict (A.Located Can.Export))
250−checkExposed decls unions aliases binops effects (A.At region exposed) =
234+checkExposed values unions aliases binops effects (A.At region exposed) =
251235 case exposed of
252236 Src.Lower name ->
253− if Map.member name decls then
237+ if Map.member name values then
254238 ok name region Can.ExportValue
255239 else
256240 case checkPorts effects name of
@@ -259,7 +243,7 @@ checkExposed decls unions aliases binops effects (A.At region exposed) =
259243
260244 Just ports ->
261245 Result.throw $ Error.ExportNotFound region Error.BadVar name $
262− ports ++ Map.keys decls
246+ ports ++ Map.keys values
263247
264248 Src.Operator name ->
265249 if Map.member name binops then
@@ -300,6 +284,6 @@ checkPorts effects name =
300284 Just []
301285
302286
303−ok :: Name.Name -> R.Region -> Can.Export -> Result i w (Dups.Dict (A.Located Can.Export))
287+ok :: Name.Name -> A.Region -> Can.Export -> Result i w (Dups.Dict (A.Located Can.Export))
304288ok name region export =
305289 Result.ok $ Dups.one name region (A.At region export)
compiler/src/Canonicalize/Pattern.hs+5−6
@@ -19,7 +19,6 @@ import qualified Data.Index as Index
1919import qualified Elm.ModuleName as ModuleName
2020import qualified Reporting.Annotation as A
2121import qualified Reporting.Error.Canonicalize as Error
22−import qualified Reporting.Region as R
2322import qualified Reporting.Result as Result
2423
2524
@@ -32,7 +31,7 @@ type Result i w a =
3231
3332
3433type Bindings =
35− Map.Map Name.Name R.Region
34+ Map.Map Name.Name A.Region
3635
3736
3837
@@ -60,7 +59,7 @@ verify context (Result.Result k) =
6059
6160
6261type DupsDict =
63− Dups.Dict R.Region
62+ Dups.Dict A.Region
6463
6564
6665canonicalize :: Env.Env -> Src.Pattern -> Result DupsDict w Can.Pattern
@@ -113,7 +112,7 @@ canonicalize env (A.At region pattern) =
113112 Result.ok (Can.PInt int)
114113
115114
116−canonicalizeCtor :: Env.Env -> R.Region -> Name.Name -> [Src.Pattern] -> Env.Ctor -> Result DupsDict w Can.Pattern_
115+canonicalizeCtor :: Env.Env -> A.Region -> Name.Name -> [Src.Pattern] -> Env.Ctor -> Result DupsDict w Can.Pattern_
117116canonicalizeCtor env region name patterns ctor =
118117 case ctor of
119118 Env.Ctor home tipe union index args ->
@@ -136,7 +135,7 @@ canonicalizeCtor env region name patterns ctor =
136135 Result.throw (Error.PatternHasRecordCtor region name)
137136
138137
139−canonicalizeTuple :: R.Region -> Env.Env -> [Src.Pattern] -> Result DupsDict w (Maybe Can.Pattern)
138+canonicalizeTuple :: A.Region -> Env.Env -> [Src.Pattern] -> Result DupsDict w (Maybe Can.Pattern)
140139canonicalizeTuple tupleRegion env extras =
141140 case extras of
142141 [] ->
@@ -165,7 +164,7 @@ canonicalizeList env list =
165164-- LOG BINDINGS
166165
167166
168−logVar :: Name.Name -> R.Region -> a -> Result DupsDict w a
167+logVar :: Name.Name -> A.Region -> a -> Result DupsDict w a
169168logVar name region value =
170169 Result.Result $ \bindings warnings _ ok ->
171170 ok (Dups.insert name region region bindings) warnings value
compiler/src/Canonicalize/Type.hs+2−3
@@ -17,7 +17,6 @@ import qualified Canonicalize.Environment as Env
1717import qualified Canonicalize.Environment.Dups as Dups
1818import qualified Reporting.Annotation as A
1919import qualified Reporting.Error.Canonicalize as Error
20−import qualified Reporting.Region as R
2120import qualified Reporting.Result as Result
2221
2322
@@ -99,7 +98,7 @@ canonicalizeFields env fields =
9998-- CANONICALIZE TYPE
10099
101100
102−canonicalizeType :: Env.Env -> R.Region -> Name.Name -> [Src.Type] -> Env.Type -> Result i w Can.Type
101+canonicalizeType :: Env.Env -> A.Region -> Name.Name -> [Src.Type] -> Env.Type -> Result i w Can.Type
103102canonicalizeType env region name args info =
104103 do cargs <- traverse (canonicalize env) args
105104 case info of
@@ -112,7 +111,7 @@ canonicalizeType env region name args info =
112111 Can.TType home name cargs
113112
114113
115−checkArity :: Int -> R.Region -> Name.Name -> [A.Located arg] -> answer -> Result i w answer
114+checkArity :: Int -> A.Region -> Name.Name -> [A.Located arg] -> answer -> Result i w answer
116115checkArity expected region name args answer =
117116 let actual = length args in
118117 if expected == actual then