on master help sign in
Remove ports

Create a clean slate for implementing effect modules

commit6d9f01b7c83efd47428d682d2a58558a44aac1d4 authorEvan Czaplicki <info@elm-lang.org> dateMon 1 Feb 2016, 11:05 (11 years ago) parent25a0d74
23 files changed+27−346
elm-compiler.cabal−2 src/AST/Declaration.hs+4−31 src/AST/Expression/General.hs−21 src/AST/Expression/Optimized.hs−3 src/AST/Module.hs+1−5 src/AST/Type.hs−14 src/Canonicalize.hs−46 src/Canonicalize/Declaration.hs−13 src/Canonicalize/Setup.hs−5 src/Canonicalize/Sort.hs+1−13 src/Compile.hs+2−3 src/Docs/Centralize.hs−3 src/Elm/Compiler.hs+2−3 src/Elm/Compiler/Module.hs−6 src/Generate/JavaScript/Expression.hs−15 src/Nitpick/PatternMatches.hs−11 src/Optimize.hs−12 src/Optimize/Inline.hs−24 src/Parse/Declaration.hs+1−27 src/Parse/Parse.hs+2−3 src/Type/Constrain/Expression.hs−11 src/Validate.hs+5−66 tests/Test/Compiler.hs+9−9
elm-compiler.cabal−2
@@ -63,7 +63,6 @@ Library
6363 Canonicalize,
6464 Canonicalize.Declaration,
6565 Canonicalize.Environment,
66− Canonicalize.Port,
6766 Canonicalize.Result,
6867 Canonicalize.Setup,
6968 Canonicalize.Sort,
@@ -81,7 +80,6 @@ Library
8180 Generate.JavaScript.Expression,
8281 Generate.JavaScript.Helpers,
8382 Generate.JavaScript.Literal,
84− Generate.JavaScript.Port,
8583 Generate.JavaScript.Variable,
8684 Nitpick.Pattern,
8785 Nitpick.PatternMatches,
src/AST/Declaration.hs+4−31
@@ -3,7 +3,6 @@ module AST.Declaration where
33
44import Data.Binary
55
6−import qualified AST.Expression.General as General
76import qualified AST.Expression.Source as Source
87import qualified AST.Expression.Valid as Valid
98import qualified AST.Expression.Canonical as Canonical
@@ -15,11 +14,10 @@ import qualified Reporting.Annotation as A
1514-- DECLARATIONS
1615
1716
18−data Declaration' port def tipe expr
17+data Declaration' def tipe expr
1918 = Definition def
2019 | Datatype String [String] [(String, [tipe])]
2120 | TypeAlias String [String] tipe
22− | Port port
2321 | Fixity Assoc Int String
2422
2523
@@ -44,7 +42,7 @@ assocToString assoc =
4442
4543
4644type SourceDecl' =
47− Declaration' SourcePort Source.Def Type.Raw Source.Expr
45+ Declaration' Source.Def Type.Raw Source.Expr
4846
4947
5048data SourceDecl
@@ -53,36 +51,11 @@ data SourceDecl
5351
5452
5553type ValidDecl =
56− A.Commented (Declaration' ValidPort Valid.Def Type.Raw Valid.Expr)
54+ A.Commented (Declaration' Valid.Def Type.Raw Valid.Expr)
5755
5856
5957type CanonicalDecl =
60− A.Commented (Declaration' CanonicalPort Canonical.Def Type.Canonical Canonical.Expr)
61−
62−
63−
64−-- PORTS
65−
66−
67−data SourcePort
68− = PortAnnotation String Type.Raw
69− | PortDefinition String Source.Expr
70−
71−
72−data ValidPort
73− = In String Type.Raw
74− | Out String Valid.Expr Type.Raw
75−
76−
77−newtype CanonicalPort
78− = CanonicalPort (General.PortImpl Canonical.Expr Type.Canonical)
79−
80−
81−validPortName :: ValidPort -> String
82−validPortName port =
83− case port of
84− In name _ -> name
85− Out name _ _ -> name
58+ A.Commented (Declaration' Canonical.Def Type.Canonical Canonical.Expr)
8659
8760
8861
src/AST/Expression/General.hs−21
@@ -10,7 +10,6 @@ module AST.Expression.General where
1010
1111import qualified AST.Literal as Literal
1212import qualified AST.Pattern as Pattern
13−import qualified AST.Type as Type
1413import qualified AST.Variable as Var
1514import qualified Reporting.Annotation as A
1615
@@ -54,30 +53,10 @@ data Expr' ann def var typ
5453 | Update (Expr ann def var typ) [(String, Expr ann def var typ)]
5554 | Record [(String, Expr ann def var typ)]
5655 -- for type checking and code gen only
57− | Port (PortImpl (Expr ann def var typ) typ)
5856 | GLShader String String Literal.GLShaderTipe
5957
6058
6159
62−-- PORTS
63−
64−
65−data PortImpl expr tipe
66− = In String (Type.Port tipe)
67− | Out String expr (Type.Port tipe)
68− | Task String expr (Type.Port tipe)
69− deriving (Eq)
70−
71−
72−portName :: PortImpl expr tipe -> String
73−portName impl =
74− case impl of
75− In name _ -> name
76− Out name _ _ -> name
77− Task name _ _ -> name
78−
79−
80−
8160---- UTILITIES ----
8261
8362
src/AST/Expression/Optimized.hs−3
@@ -5,10 +5,8 @@ module AST.Expression.Optimized
55 , Decider(..), Choice(..)
66 ) where
77
8−import qualified AST.Expression.General as General
98import qualified AST.Literal as Literal
109import qualified AST.Module.Name as ModuleName
11−import qualified AST.Type as Type
1210import qualified AST.Variable as Var
1311import qualified Optimize.DecisionTree as DT
1412import qualified Reporting.Region as R
@@ -52,7 +50,6 @@ data Expr
5250 | Access Expr String
5351 | Update Expr [(String, Expr)]
5452 | Record [(String, Expr)]
55− | Port (General.PortImpl Expr Type.Canonical)
5653 | GLShader String String Literal.GLShaderTipe
5754 | Crash ModuleName.Canonical R.Region (Maybe Expr)
5855
src/AST/Module.hs+1−5
@@ -98,7 +98,6 @@ data Body expr =
9898 , fixities :: [(Decl.Assoc, Int, String)]
9999 , aliases :: Aliases
100100 , datatypes :: ADTs
101− , ports :: [String]
102101 }
103102
104103
@@ -148,7 +147,6 @@ data Interface =
148147 , iAdts :: ADTs
149148 , iAliases :: Aliases
150149 , iFixities :: [(Decl.Assoc, Int, String)]
151− , iPorts :: [String]
152150 }
153151
154152
@@ -167,13 +165,12 @@ toInterface pkgName modul =
167165 , iAdts = datatypes body'
168166 , iAliases = aliases body'
169167 , iFixities = fixities body'
170− , iPorts = ports body'
171168 }
172169
173170
174171instance Binary Interface where
175172 get =
176− Interface <$> get <*> get <*> get <*> get <*> get <*> get <*> get <*> get <*> get
173+ Interface <$> get <*> get <*> get <*> get <*> get <*> get <*> get <*> get
177174
178175 put modul =
179176 do put (iVersion modul)
@@ -184,4 +181,3 @@ instance Binary Interface where
184181 put (iAdts modul)
185182 put (iAliases modul)
186183 put (iFixities modul)
187− put (iPorts modul)
src/AST/Type.hs−14
@@ -1,7 +1,6 @@
11module AST.Type
22 ( Raw, Raw'(..)
33 , Canonical(..), Aliased(..)
4− , Port(..), getPortType
54 , deepDealias, iteratedDealias, dealias
65 , collectLambdas
76 , tuple
@@ -48,19 +47,6 @@ data Aliased t
4847 deriving (Eq, Ord)
4948
5049
51−data Port t
52− = Normal t
53− | Signal { root :: t, arg :: t }
54− deriving (Eq)
55−
56−
57−getPortType :: Port tipe -> tipe
58−getPortType portType =
59− case portType of
60− Normal tipe -> tipe
61− Signal tipe _ -> tipe
62−
63−
6450tuple :: R.Region -> [Raw] -> Raw
6551tuple region types =
6652 let
src/Canonicalize.hs−46
@@ -31,7 +31,6 @@ import qualified Reporting.Result as R
3131import qualified Reporting.Warning as Warning
3232import qualified Canonicalize.Declaration as Decls
3333import qualified Canonicalize.Environment as Env
34−import qualified Canonicalize.Port as Port
3534import qualified Canonicalize.Result as Result
3635import qualified Canonicalize.Setup as Setup
3736import qualified Canonicalize.Sort as Sort
@@ -120,9 +119,6 @@ moduleHelp importDict interfaces modul@(Module.Module _ _ comment exports _ decl
120119
121120 , aliases =
122121 Map.fromList [ (name,(tvs,alias)) | D.TypeAlias name tvs alias <- nakedDecls ]
123−
124− , ports =
125− [ E.portName impl | D.Port (D.CanonicalPort impl) <- nakedDecls ]
126122 }
127123
128124
@@ -354,25 +350,6 @@ declaration env (A.A ann@(region,_) decl) =
354350 D.TypeAlias name tvars
355351 <$> Canonicalize.tipe env expanded
356352
357− D.Port validPort ->
358− Result.addModule ["Native","Port"] $
359− Result.addModule ["Native","Json"] $
360− case validPort of
361− D.In name tipe ->
362− Canonicalize.tipe env tipe
363− `Result.andThen` \canonicalType ->
364− D.Port <$> Port.check region name Nothing canonicalType
365−
366− D.Out name expr tipe ->
367− let exprTypeResult =
368− (,)
369− <$> expression env expr
370− <*> Canonicalize.tipe env tipe
371− in
372− exprTypeResult
373− `Result.andThen` \(expr', tipe') ->
374− D.Port <$> Port.check region name (Just expr') tipe'
375−
376353 D.Fixity assoc prec op ->
377354 Result.ok (D.Fixity assoc prec op)
378355
@@ -462,29 +439,6 @@ expression env (A.A region validExpr) =
462439 (,) <$> pattern env ptrn
463440 <*> expression (Env.addPattern ptrn env) brnch
464441
465− Port impl ->
466− let portType pt =
467− case pt of
468− Type.Normal t ->
469− Type.Normal
470− <$> Canonicalize.tipe env t
471−
472− Type.Signal root arg ->
473− Type.Signal
474− <$> Canonicalize.tipe env root
475− <*> Canonicalize.tipe env arg
476− in
477− Port <$>
478− case impl of
479− E.In name tipe ->
480− E.In name <$> portType tipe
481−
482− E.Out name expr tipe ->
483− E.Out name <$> go expr <*> portType tipe
484−
485− E.Task name expr tipe ->
486− E.Task name <$> go expr <*> portType tipe
487−
488442 GLShader uid src tipe ->
489443 Result.ok (GLShader uid src tipe)
490444
src/Canonicalize/Declaration.hs−13
@@ -60,19 +60,6 @@ toDefs moduleName (A.A (region,_) decl) =
6060 D.TypeAlias _ _ _ ->
6161 []
6262
63− D.Port (D.CanonicalPort impl) ->
64− let body = loc (E.Port impl)
65− in
66− case impl of
67− E.In name tipe ->
68− [ definition name body region (T.getPortType tipe) ]
69−
70− E.Out name _expr tipe ->
71− [ definition name body region (T.getPortType tipe) ]
72−
73− E.Task name _expr tipe ->
74− [ definition name body region (T.getPortType tipe) ]
75−
7663 -- no constraints are needed for fixity declarations
7764 D.Fixity _ _ _ ->
7865 []
src/Canonicalize/Setup.hs−5
@@ -351,11 +351,6 @@ declToPatches moduleName (A.A (region,_) decl) =
351351 []
352352 )
353353
354− D.Port port ->
355− ( Nothing
356− , [topLevel Env.Value (D.validPortName port)]
357− )
358−
359354 D.Fixity _ _ _ ->
360355 ( Nothing
361356 , []
src/Canonicalize/Sort.hs+1−13
@@ -7,7 +7,7 @@ import qualified Data.Map as Map
77import qualified Data.Maybe as Maybe
88import qualified Data.Set as Set
99
10−import AST.Expression.General (Expr'(..), PortImpl(..))
10+import AST.Expression.General (Expr'(..))
1111import qualified AST.Expression.Canonical as Canonical
1212import qualified AST.Pattern as P
1313import qualified AST.Variable as V
@@ -99,18 +99,6 @@ reorder (A.A ann expression) =
9999 GLShader _ _ _ ->
100100 return expression
101101
102− Port impl ->
103− Port <$>
104− case impl of
105− In _ _ ->
106− return impl
107−
108− Out name expr tipe ->
109− (\e -> Out name e tipe) <$> reorder expr
110−
111− Task name expr tipe ->
112− (\e -> Task name e tipe) <$> reorder expr
113−
114102 -- Actually do some reordering
115103 Let defs body ->
116104 do body' <- reorder body
src/Compile.hs+2−3
@@ -20,18 +20,17 @@ import qualified Type.Inference as TI
2020
2121compile
2222 :: Package.Name
23− -> Bool
2423 -> [ModuleName.Canonical]
2524 -> Module.Interfaces
2625 -> String
2726 -> Result.Result Warning.Warning Error.Error Module.Optimized
2827
29−compile packageName isRoot canonicalImports interfaces source =
28+compile packageName canonicalImports interfaces source =
3029 do
3130 -- Parse the source code
3231 validModule <-
3332 Result.mapError Error.Syntax $
34− Parse.program packageName isRoot (getOpTable interfaces) source
33+ Parse.program packageName (getOpTable interfaces) source
3534
3635 -- Canonicalize all variables, pinning down where they came from.
3736 canonicalModule <-
src/Docs/Centralize.hs−3
@@ -86,9 +86,6 @@ addDeclToDocs (A.A (region,maybeComment) decl) docs =
8686 in
8787 docs { rawAliases = Map.insert name alias (rawAliases docs) }
8888
89− D.Port _ ->
90− docs
91−
9289 D.Fixity assoc precedence name ->
9390 let
9491 fixity =
src/Elm/Compiler.hs+2−3
@@ -71,11 +71,11 @@ compile
7171
7272compile context source interfaces =
7373 let
74− (Context packageName isRoot isExposed dependencies) =
74+ (Context packageName isExposed dependencies) =
7575 context
7676
7777 (Result.Result (localizer, warnings) rawResult) =
78− do modul <- Compile.compile packageName isRoot dependencies interfaces source
78+ do modul <- Compile.compile packageName dependencies interfaces source
7979 docs <- docsGen isExposed modul
8080
8181 let interface = Module.toInterface packageName modul
@@ -91,7 +91,6 @@ compile context source interfaces =
9191
9292data Context = Context
9393 { _packageName :: Package.Name
94− , _isRoot :: Bool
9594 , _isExposed :: Bool
9695 , _dependencies :: [PublicModule.CanonicalName]
9796 }
src/Elm/Compiler/Module.hs−6
@@ -5,7 +5,6 @@ module Elm.Compiler.Module
55 , nameToString, nameFromString
66 , hyphenate, dehyphenate
77 , defaultImports
8− , interfacePorts
98 , interfaceAliasedTypes
109 , CanonicalName, canonicalName
1110 )
@@ -38,11 +37,6 @@ type Interface = Module.Interface
3837type Interfaces = Module.Interfaces
3938
4039
41−interfacePorts :: Interface -> [String]
42−interfacePorts interface =
43− Module.iPorts interface
44−
45−
4640interfaceAliasedTypes :: Interface -> Map.Map String Type.Type
4741interfaceAliasedTypes interface =
4842 Map.map Extract.toAliasedType (Module.iTypes interface)
src/Generate/JavaScript/Expression.hs−15
@@ -6,7 +6,6 @@ import qualified Data.List as List
66import qualified Data.Map as Map
77import Language.ECMAScript3.Syntax
88
9−import qualified AST.Expression.General as Expr
109import AST.Expression.Optimized as Opt
1110import qualified AST.Literal as L
1211import qualified AST.Module.Name as ModuleName
@@ -14,7 +13,6 @@ import qualified AST.Variable as Var
1413import Generate.JavaScript.Helpers as Help
1514import qualified Generate.JavaScript.BuiltIn as BuiltIn
1615import qualified Generate.JavaScript.Literal as Literal
17−import qualified Generate.JavaScript.Port as Port
1816import qualified Generate.JavaScript.Variable as Var
1917import qualified Optimize.DecisionTree as DT
2018
@@ -196,19 +194,6 @@ generateCode expr =
196194 GLShader _uid src _tipe ->
197195 jsExpr $ ObjectLit () [(PropString () "src", Literal.literal (L.Str src))]
198196
199− Port impl ->
200− case impl of
201− Expr.In name portType ->
202− jsExpr (Port.inbound name portType)
203−
204− Expr.Out name expr portType ->
205− do expr' <- generateJsExpr expr
206− jsExpr (Port.outbound name expr' portType)
207−
208− Expr.Task name expr portType ->
209− do expr' <- generateJsExpr expr
210− jsExpr (Port.task name expr' portType)
211−
212197 Crash home region maybeBranchProblem ->
213198 do maybeOptBranchProblem <- traverse generateJsExpr maybeBranchProblem
214199 jsExpr $ BuiltIn.crash home region maybeOptBranchProblem
src/Nitpick/PatternMatches.hs−11
@@ -180,17 +180,6 @@ checkExpression tagDict (A.A region expression) =
180180 E.Record fields ->
181181 F.traverse_ (go . snd) fields
182182
183− E.Port impl ->
184− case impl of
185− E.In _ _ ->
186− Result.ok ()
187−
188− E.Out _ expr _ ->
189− go expr
190−
191− E.Task _ expr _ ->
192− go expr
193−
194183 E.GLShader _ _ _ ->
195184 Result.ok ()
196185
src/Optimize.hs−12
@@ -308,18 +308,6 @@ optimizeExpr context annExpr@(A.A region expression) =
308308 Expr.GLShader uid src gltipe ->
309309 pure (Opt.GLShader uid src gltipe)
310310
311− Expr.Port impl ->
312− Opt.Port <$>
313− case impl of
314− Expr.In name tipe ->
315− pure (Expr.In name tipe)
316−
317− Expr.Out name expr tipe ->
318− (\e -> Expr.Out name e tipe) <$> justConvert expr
319−
320− Expr.Task name expr tipe ->
321− (\e -> Expr.Task name e tipe) <$> justConvert expr
322−
323311
324312mapSnd :: M.Functor box => (a -> box b) -> (x, a) -> box (x, b)
325313mapSnd func (x, a) =
src/Optimize/Inline.hs−24
@@ -6,7 +6,6 @@ import Control.Monad (foldM)
66import qualified Data.List as List
77import qualified Data.Map as Map
88
9−import AST.Expression.General (PortImpl(..))
109import AST.Expression.Optimized (Expr(..), Decider(..), Choice(..))
1110import qualified AST.Expression.Optimized as Opt
1211import qualified AST.Variable as Var
@@ -165,17 +164,6 @@ count expression =
165164 Record fields ->
166165 countMany (map snd fields)
167166
168− Port impl ->
169− case impl of
170− In _ _ ->
171− Map.empty
172−
173− Out _name expr _tipe ->
174− count expr
175−
176− Task _name expr _tipe ->
177− count expr
178−
179167 GLShader _ _ _ ->
180168 Map.empty
181169
@@ -275,18 +263,6 @@ replace substitutions expression =
275263 Record fields ->
276264 Record (map (second go) fields)
277265
278− Port impl ->
279− Port $
280− case impl of
281− In _ _ ->
282− impl
283−
284− Out name expr tipe ->
285− Out name (go expr) tipe
286−
287− Task name expr tipe ->
288− Task name (go expr) tipe
289−
290266 GLShader _ _ _ ->
291267 expression
292268
src/Parse/Declaration.hs+1−27
@@ -14,7 +14,7 @@ declaration :: IParser D.SourceDecl
1414declaration =
1515 choice
1616 [ D.Comment <$> Help.docComment
17− , D.Decl <$> addLocation (typeDecl <|> infixDecl <|> port <|> definition)
17+ , D.Decl <$> addLocation (typeDecl <|> infixDecl <|> definition)
1818 ]
1919
2020
@@ -71,29 +71,3 @@ infixDecl =
7171 forcedWS
7272 D.Fixity assoc (read [n]) <$> anyOp
7373
74−
75−
76−-- PORT
77−
78−
79−port :: IParser D.SourceDecl'
80−port =
81− expecting "a port declaration" $
82− do try (reserved "port")
83− whitespace
84− name <- lowVar
85− whitespace
86− choice [ portAnnotation name, portDefinition name ]
87− where
88− portAnnotation name =
89− do try hasType
90− whitespace
91− tipe <- Type.expr <?> "a type"
92− return (D.Port (D.PortAnnotation name tipe))
93−
94− portDefinition name =
95− do try equals
96− whitespace
97− expr <- Expr.expr
98− return (D.Port (D.PortDefinition name expr))
99−
src/Parse/Parse.hs+2−3
@@ -22,15 +22,14 @@ import qualified Validate
2222
2323program
2424 :: Package.Name
25− -> Bool
2625 -> OpTable
2726 -> String
2827 -> Result.Result wrn Error.Error M.ValidModule
29−program pkgName isRoot table src =
28+program pkgName table src =
3029 do (M.Module name filePath docs exports imports sourceDecls) <-
3130 parseWithTable table src (programParser pkgName)
3231
33− validDecls <- Validate.declarations isRoot sourceDecls
32+ validDecls <- Validate.declarations sourceDecls
3433
3534 -- determine if default imports should be added, only elm-lang/core is exempt
3635 let ammendedImports =
src/Type/Constrain/Expression.hs−11
@@ -160,17 +160,6 @@ constrain env annotatedExpr@(A.A region expression) tipe =
160160
161161 return $ CLet schemes (CLet letScheme (c1 /\ bodyCon))
162162
163− E.Port impl ->
164− case impl of
165− E.In _ _ ->
166− return CTrue
167−
168− E.Out _ expr _ ->
169− constrain env expr tipe
170−
171− E.Task _ expr _ ->
172− constrain env expr tipe
173−
174163
175164
176165-- CONSTRAIN APP
src/Validate.hs+5−66
@@ -25,14 +25,13 @@ import qualified Reporting.Result as Result
2525
2626
2727declarations
28− :: Bool
29− -> [D.SourceDecl]
28+ :: [D.SourceDecl]
3029 -> Result.Result wrn Error.Error [D.ValidDecl]
31−declarations isRoot sourceDecls =
30+declarations sourceDecls =
3231 do validDecls <- validateDecls Nothing sourceDecls
3332 (\_ _ -> validDecls)
3433 <$> declDuplicates validDecls
35− <*> T.traverse (checkDecl isRoot) validDecls
34+ <*> T.traverse checkDecl validDecls
3635
3736
3837validateDecls
@@ -76,9 +75,6 @@ validateDeclsHelp comment (A.A region decl) decls =
7675 D.Definition def ->
7776 defHelp comment def decls
7877
79− D.Port port ->
80− portHelp comment region port decls
81−
8278
8379
8480-- VALIDATE DEFINITIONS IN DECLARATIONS
@@ -116,37 +112,6 @@ defHelp comment (A.A region def) decls =
116112
117113
118114
119−-- VALIDATE PORTS IN DECLARATIONS
120−
121−
122−portHelp
123− :: Maybe String
124− -> R.Region
125− -> D.SourcePort
126− -> [D.SourceDecl]
127− -> Result.Result wrn Error.Error [D.ValidDecl]
128−portHelp comment region port decls =
129− let addRest port' rest =
130− (:) (A.A (region,comment) (D.Port port'))
131− <$> validateDecls Nothing rest
132− in
133− case port of
134− D.PortDefinition name _ ->
135− Result.throw region (Error.PortWithoutAnnotation name)
136−
137− D.PortAnnotation name tipe ->
138− case decls of
139− D.Decl (A.A _ (D.Port (D.PortDefinition name' expr))) : rest
140− | name == name' ->
141− do expr' <- expression expr
142− let port' = D.Out name expr' tipe
143− addRest port' rest
144−
145− _ ->
146− addRest (D.In name tipe) decls
147−
148−
149−
150115-- VALIDATE DEFINITIONS
151116
152117
@@ -283,20 +248,6 @@ expression (A.A ann sourceExpression) =
283248 GLShader uid src gltipe ->
284249 return (GLShader uid src gltipe)
285250
286− Port impl ->
287− Port <$>
288− case impl of
289− In name tipe ->
290− return (In name tipe)
291−
292− Out name expr tipe ->
293− do expr' <- expression expr
294− return (Out name expr' tipe)
295−
296− Task name expr tipe ->
297− do expr' <- expression expr
298− return (Task name expr' tipe)
299−
300251
301252second :: (a, Source.Expr) -> Result.Result wrn Error.Error (a, Valid.Expr)
302253second (value, expr) =
@@ -386,11 +337,6 @@ extractValues (A.A (region, _) decl) =
386337 , [A.A region name]
387338 )
388339
389− D.Port port ->
390− ( [A.A region (D.validPortName port)]
391− , []
392− )
393−
394340 D.Fixity _ _ _ ->
395341 ( []
396342 , []
@@ -401,8 +347,8 @@ extractValues (A.A (region, _) decl) =
401347-- UNBOUND TYPE VARIABLES
402348
403349
404−checkDecl :: Bool -> D.ValidDecl -> Result.Result wrn Error.Error ()
405−checkDecl isRoot (A.A (region,_) decl) =
350+checkDecl :: D.ValidDecl -> Result.Result wrn Error.Error ()
351+checkDecl (A.A (region,_) decl) =
406352 case decl of
407353 D.Definition _ ->
408354 return ()
@@ -433,13 +379,6 @@ checkDecl isRoot (A.A (region,_) decl) =
433379 Result.throw region
434380 (Error.MessyTypeVarsInAlias name boundVars unused unbound)
435381
436− D.Port _ ->
437− if isRoot then
438− return ()
439−
440− else
441− Result.throw region Error.UnexpectedPort
442−
443382 D.Fixity _ _ _ ->
444383 return ()
445384
tests/Test/Compiler.hs+9−9
@@ -86,15 +86,15 @@ essentialInterfaces =
8686
8787buildCoreInterface :: [(String, Type.Canonical)] -> Module.Interface
8888buildCoreInterface members =
89− let exports = map (Variable.Value . fst) members
90− imports = []
91− types = Map.fromList members
92− adts = Map.empty
93− aliases = Map.empty
94− fixities = []
95− ports = []
89+ let
90+ exports = map (Variable.Value . fst) members
91+ imports = []
92+ types = Map.fromList members
93+ adts = Map.empty
94+ aliases = Map.empty
95+ fixities = []
9696 in
97− Module.Interface Compiler.version Package.coreName exports types imports adts aliases fixities ports
97+ Module.Interface Compiler.version Package.coreName exports types imports adts aliases fixities
9898
9999
100100compileString :: FilePath -> String -> Either String Compiler.Result
@@ -102,7 +102,7 @@ compileString filePath source =
102102 let dependentModuleNames =
103103 Map.keys essentialInterfaces
104104 context =
105− Compiler.Context Package.coreName True False dependentModuleNames
105+ Compiler.Context Package.coreName False dependentModuleNames
106106 (dealiaser, _warnings, result) =
107107 Compiler.compile context source essentialInterfaces
108108 formatErrors errors =