@@ -11,10 +11,10 @@ import qualified Data.Map as Map
11import qualified Data.Set as Set
11import qualified Data.Set as Set
12import Data.Text (Text)
12import Data.Text (Text)
14−import qualified AST.Expression.Canonical as Can
14+import qualified AST.Canonical as Can
15−import qualified AST.Expression.Valid as Valid
15+import qualified AST.Valid as Valid
16import qualified AST.Module.Name as ModuleName
16import qualified AST.Module.Name as ModuleName
17−import qualified AST.Type as Type
17+import qualified AST.Utils.Type as Type
18import qualified Canonicalize.Environment as Env
18import qualified Canonicalize.Environment as Env
19import qualified Canonicalize.Type as Type
19import qualified Canonicalize.Type as Type
20import qualified Elm.Name as N
20import qualified Elm.Name as N
@@ -80,7 +80,7 @@ canonicalizePort :: Env.Env -> Valid.Port -> Result (N.Name, Can.Port)
80canonicalizePort env (Valid.Port (A.A region portName) tipe) =
80canonicalizePort env (Valid.Port (A.A region portName) tipe) =
81 do ctipe <- Type.canonicalize env tipe
81 do ctipe <- Type.canonicalize env tipe
82 case Type.deepDealias ctipe of
82 case Type.deepDealias ctipe of
83− Type.Lambda outgoingType (Type.Type home name [Type.Var _])
83+ Can.TLambda outgoingType (Can.TType home name [Can.TVar _])
84 | home == ModuleName.cmd && name == "Cmd" ->
84 | home == ModuleName.cmd && name == "Cmd" ->
85 case checkPayload outgoingType of
85 case checkPayload outgoingType of
86 Left (badType, err) ->
86 Left (badType, err) ->
@@ -89,7 +89,7 @@ canonicalizePort env (Valid.Port (A.A region portName) tipe) =
89 Right () ->
89 Right () ->
90 Result.ok (portName, Can.Outgoing ctipe)
90 Result.ok (portName, Can.Outgoing ctipe)
92− Type.Lambda (Type.Lambda incomingType (Type.Var msg1)) (Type.Type home name [Type.Var msg2])
92+ Can.TLambda (Can.TLambda incomingType (Can.TVar msg1)) (Can.TType home name [Can.TVar msg2])
93 | home == ModuleName.sub && name == "Sub" && msg1 == msg2 ->
93 | home == ModuleName.sub && name == "Sub" && msg1 == msg2 ->
94 case checkPayload incomingType of
94 case checkPayload incomingType of
95 Left (badType, err) ->
95 Left (badType, err) ->
@@ -133,13 +133,13 @@ verifyManager tagRegion decls name =
133-- CHECK PAYLOAD TYPES
133-- CHECK PAYLOAD TYPES
136−checkPayload :: Type.Canonical -> Either (Type.Canonical, Error.InvalidPayload) ()
136+checkPayload :: Can.Type -> Either (Can.Type, Error.InvalidPayload) ()
137checkPayload tipe =
137checkPayload tipe =
138 case tipe of
138 case tipe of
139− Type.Aliased _ _ args aliasedType ->
139+ Can.TAlias _ _ args aliasedType ->
140 checkPayload (Type.dealias args aliasedType)
140 checkPayload (Type.dealias args aliasedType)
142− Type.Type home name args ->
142+ Can.TType home name args ->
143 case args of
143 case args of
145 | isPrim home name -> Right ()
145 | isPrim home name -> Right ()
@@ -153,10 +153,10 @@ checkPayload tipe =
154 Left (tipe, Error.UnsupportedType name)
154 Left (tipe, Error.UnsupportedType name)
156− Type.Unit ->
156+ Can.TUnit ->
159− Type.Tuple a b maybeC ->
159+ Can.TTuple a b maybeC ->
160 do checkPayload a
160 do checkPayload a
161 checkPayload b
161 checkPayload b
162 case maybeC of
162 case maybeC of
@@ -166,16 +166,16 @@ checkPayload tipe =
166 Just c ->
166 Just c ->
167 checkPayload c
167 checkPayload c
169− Type.Var name ->
169+ Can.TVar name ->
170 Left (tipe, Error.TypeVariable name)
170 Left (tipe, Error.TypeVariable name)
172− Type.Lambda _ _ ->
172+ Can.TLambda _ _ ->
173 Left (tipe, Error.Function)
173 Left (tipe, Error.Function)
175− Type.Record _ (Just _) ->
175+ Can.TRecord _ (Just _) ->
176 Left (tipe, Error.ExtendedRecord)
176 Left (tipe, Error.ExtendedRecord)
178− Type.Record fields Nothing ->
178+ Can.TRecord fields Nothing ->
179 F.traverse_ checkPayload fields
179 F.traverse_ checkPayload fields