@@ -36,7 +36,7 @@ type Result warning a =
39−validate :: Module.Source -> Result wrn Module.Valid
39+validate :: Module.Source -> Result w Module.Valid
40validate (Module.Module name info) =
40validate (Module.Module name info) =
42 (ModuleName.Canonical pkgName _) =
42 (ModuleName.Canonical pkgName _) =
@@ -79,7 +79,7 @@ validateEffects
79 -> Module.SourceSettings
79 -> Module.SourceSettings
80 -> [A.Commented Effects.PortRaw]
80 -> [A.Commented Effects.PortRaw]
81 -> [A.Commented Src.ValidDef]
81 -> [A.Commented Src.ValidDef]
82− -> Result wrn Effects.Raw
82+ -> Result w Effects.Raw
83validateEffects tag settings@(A.A _ pairs) ports validDefs =
83validateEffects tag settings@(A.A _ pairs) ports validDefs =
84 case tag of
84 case tag of
85 Module.Normal ->
85 Module.Normal ->
@@ -105,7 +105,7 @@ validateEffects tag settings@(A.A _ pairs) ports validDefs =
105 return (Effects.Manager () (Effects.Info tagRegion r0 r1 r2 managerType))
105 return (Effects.Manager () (Effects.Info tagRegion r0 r1 r2 managerType))
108−noSettings :: Error.Error -> Module.SourceSettings -> Result wrn ()
108+noSettings :: Error.Error -> Module.SourceSettings -> Result w ()
109noSettings errorMsg (A.A region settings) =
109noSettings errorMsg (A.A region settings) =
110 case settings of
110 case settings of
@@ -115,7 +115,7 @@ noSettings errorMsg (A.A region settings) =
115 Result.throw region errorMsg
115 Result.throw region errorMsg
118−noPorts :: [A.Commented Effects.PortRaw] -> Result wrn ()
118+noPorts :: [A.Commented Effects.PortRaw] -> Result w ()
119noPorts ports =
119noPorts ports =
120 case ports of
120 case ports of
@@ -132,7 +132,7 @@ noPorts ports =
132toManagerType
132toManagerType
133 :: R.Region
133 :: R.Region
134 -> Map.Map Text [(R.Region, A.Located Text)]
134 -> Map.Map Text [(R.Region, A.Located Text)]
135− -> Result wrn Effects.RawManagerType
135+ -> Result w Effects.RawManagerType
136toManagerType tagRegion settingsDict =
136toManagerType tagRegion settingsDict =
138 toErrors name entries =
138 toErrors name entries =
@@ -169,7 +169,7 @@ toManagerType tagRegion settingsDict =
169extractOne
169extractOne
171 -> Map.Map Text [(R.Region, A.Located Text)]
171 -> Map.Map Text [(R.Region, A.Located Text)]
172− -> Result wrn (Maybe (A.Located Text))
172+ -> Result w (Maybe (A.Located Text))
173extractOne name settingsDict =
173extractOne name settingsDict =
174 case Map.lookup name settingsDict of
174 case Map.lookup name settingsDict of
175 Nothing ->
175 Nothing ->
@@ -193,7 +193,7 @@ checkManager
193 :: R.Region
193 :: R.Region
194 -> Effects.RawManagerType
194 -> Effects.RawManagerType
195 -> [A.Commented Src.ValidDef]
195 -> [A.Commented Src.ValidDef]
196− -> Result wrn (R.Region, R.Region, R.Region)
196+ -> Result w (R.Region, R.Region, R.Region)
197checkManager tagRegion managerType validDefs =
197checkManager tagRegion managerType validDefs =
199 regionDict =
199 regionDict =
@@ -220,7 +220,7 @@ requireMaps
220 :: R.Region
220 :: R.Region
221 -> Map.Map Text R.Region
221 -> Map.Map Text R.Region
222 -> Effects.RawManagerType
222 -> Effects.RawManagerType
223− -> Result wrn ()
223+ -> Result w ()
224requireMaps tagRegion regionDict managerType =
224requireMaps tagRegion regionDict managerType =
226 check name =
226 check name =
@@ -238,7 +238,7 @@ requireMaps tagRegion regionDict managerType =
238 check "cmdMap" <* check "subMap"
238 check "cmdMap" <* check "subMap"
241−requireRegion :: R.Region -> Map.Map Text R.Region -> Text -> Result wrn R.Region
241+requireRegion :: R.Region -> Map.Map Text R.Region -> Text -> Result w R.Region
242requireRegion tagRegion regionDict name =
242requireRegion tagRegion regionDict name =
243 case Map.lookup name regionDict of
243 case Map.lookup name regionDict of
244 Just region ->
244 Just region ->
@@ -252,7 +252,7 @@ requireRegion tagRegion regionDict name =
252-- COLLAPSE COMMENTS
252-- COLLAPSE COMMENTS
255−collapseComments :: [D.CommentOr (A.Located a)] -> Result wrn [A.Commented a]
255+collapseComments :: [D.CommentOr (A.Located a)] -> Result w [A.Commented a]
256collapseComments listWithComments =
256collapseComments listWithComments =
257 case listWithComments of
257 case listWithComments of
@@ -282,7 +282,7 @@ collapseComments listWithComments =
282-- VALIDATE STRUCTURED SOURCE
282-- VALIDATE STRUCTURED SOURCE
285−validateDecls :: [D.Source] -> Result wrn ValidStuff
285+validateDecls :: [D.Source] -> Result w ValidStuff
286validateDecls sourceDecls =
286validateDecls sourceDecls =
287 do rawDecls <- collapseComments sourceDecls
287 do rawDecls <- collapseComments sourceDecls
@@ -307,7 +307,7 @@ data ValidStuff =
310−validateRawDecls :: [A.Commented D.Raw] -> Result wrn ValidStuff
310+validateRawDecls :: [A.Commented D.Raw] -> Result w ValidStuff
311validateRawDecls commentedDecls =
311validateRawDecls commentedDecls =
312 vrdHelp commentedDecls [] (D.Decls [] [] [] [])
312 vrdHelp commentedDecls [] (D.Decls [] [] [] [])
@@ -316,7 +316,7 @@ vrdHelp
316 :: [A.Commented D.Raw]
316 :: [A.Commented D.Raw]
317 -> [A.Commented Effects.PortRaw]
317 -> [A.Commented Effects.PortRaw]
318 -> D.Valid
318 -> D.Valid
319− -> Result wrn ValidStuff
319+ -> Result w ValidStuff
320vrdHelp commentedDecls ports structure =
320vrdHelp commentedDecls ports structure =
321 case commentedDecls of
321 case commentedDecls of
@@ -346,7 +346,7 @@ vrdDefHelp
346 -> A.Commented Src.RawDef'
346 -> A.Commented Src.RawDef'
347 -> [A.Commented Effects.PortRaw]
347 -> [A.Commented Effects.PortRaw]
348 -> D.Valid
348 -> D.Valid
349− -> Result wrn ValidStuff
349+ -> Result w ValidStuff
350vrdDefHelp remainingDecls (A.A ann def) ports structure =
350vrdDefHelp remainingDecls (A.A ann def) ports structure =
352 addDef validDef (ValidStuff finalPorts struct) =
352 addDef validDef (ValidStuff finalPorts struct) =
@@ -375,7 +375,7 @@ vrdDefHelp remainingDecls (A.A ann def) ports structure =
375-- VALIDATE DEFINITIONS
375-- VALIDATE DEFINITIONS
378−definitions :: [Src.RawDef] -> Result wrn [Src.ValidDef]
378+definitions :: [Src.RawDef] -> Result w [Src.ValidDef]
379definitions sourceDefs =
379definitions sourceDefs =
380 do validDefs <- definitionsHelp sourceDefs
380 do validDefs <- definitionsHelp sourceDefs
@@ -387,7 +387,7 @@ definitions sourceDefs =
387 return validDefs
387 return validDefs
390−definitionsHelp :: [Src.RawDef] -> Result wrn [Src.ValidDef]
390+definitionsHelp :: [Src.RawDef] -> Result w [Src.ValidDef]
391definitionsHelp sourceDefs =
391definitionsHelp sourceDefs =
392 case sourceDefs of
392 case sourceDefs of
@@ -415,7 +415,7 @@ validateDef
415 -> Pattern.Raw
415 -> Pattern.Raw
416 -> Src.RawExpr
416 -> Src.RawExpr
417 -> Maybe Type.Raw
417 -> Maybe Type.Raw
418− -> Result wrn Src.ValidDef
418+ -> Result w Src.ValidDef
419validateDef region pat expr maybeType =
419validateDef region pat expr maybeType =
420 do validExpr <- expression expr
420 do validExpr <- expression expr
421 validateDefPattern pat validExpr
421 validateDefPattern pat validExpr
@@ -423,7 +423,7 @@ validateDef region pat expr maybeType =
423 return $ Src.Def region pat validExpr maybeType
423 return $ Src.Def region pat validExpr maybeType
426−validateDefPattern :: Pattern.Raw -> Src.ValidExpr -> Result wrn ()
426+validateDefPattern :: Pattern.Raw -> Src.ValidExpr -> Result w ()
427validateDefPattern pattern body =
427validateDefPattern pattern body =
428 case fst (Src.collectLambdas body) of
428 case fst (Src.collectLambdas body) of
@@ -442,7 +442,7 @@ validateDefPattern pattern body =
442 Result.throw (R.merge start end) (Error.BadFunctionName (length args))
442 Result.throw (R.merge start end) (Error.BadFunctionName (length args))
445−checkArguments :: Text -> [Pattern.Raw] -> Result wrn ()
445+checkArguments :: Text -> [Pattern.Raw] -> Result w ()
446checkArguments funcName args =
446checkArguments funcName args =
@@ -462,7 +462,7 @@ checkArguments funcName args =
462-- VALIDATE EXPRESSIONS
462-- VALIDATE EXPRESSIONS
465−expression :: Src.RawExpr -> Result wrn Src.ValidExpr
465+expression :: Src.RawExpr -> Result w Src.ValidExpr
466expression (A.A ann sourceExpression) =
466expression (A.A ann sourceExpression) =
467 A.A ann <$>
467 A.A ann <$>
468 case sourceExpression of
468 case sourceExpression of
@@ -532,17 +532,17 @@ expression (A.A ann sourceExpression) =
532 return (Src.GLShader uid src gltipe)
532 return (Src.GLShader uid src gltipe)
535−second :: (a, Src.RawExpr) -> Result wrn (a, Src.ValidExpr)
535+second :: (a, Src.RawExpr) -> Result w (a, Src.ValidExpr)
536second (value, expr) =
536second (value, expr) =
537 (,) value <$> expression expr
537 (,) value <$> expression expr
540−both :: (Src.RawExpr, Src.RawExpr) -> Result wrn (Src.ValidExpr, Src.ValidExpr)
540+both :: (Src.RawExpr, Src.RawExpr) -> Result w (Src.ValidExpr, Src.ValidExpr)
541both (expr1, expr2) =
541both (expr1, expr2) =
542 (,) <$> expression expr1 <*> expression expr2
542 (,) <$> expression expr1 <*> expression expr2
545−checkDuplicateFields :: R.Region -> [(A.Located Text, a)] -> Result wrn ()
545+checkDuplicateFields :: R.Region -> [(A.Located Text, a)] -> Result w ()
546checkDuplicateFields recordRegion fields =
546checkDuplicateFields recordRegion fields =
548 checkDups seenFields ( A.A region field, _ ) =
548 checkDups seenFields ( A.A region field, _ ) =
@@ -558,7 +558,7 @@ checkDuplicateFields recordRegion fields =
558-- VALIDATE PATTERNS
558-- VALIDATE PATTERNS
561−validatePattern :: Pattern.Raw -> Result wrn Pattern.Raw
561+validatePattern :: Pattern.Raw -> Result w Pattern.Raw
562validatePattern pattern =
562validatePattern pattern =
563 do detectDuplicates Error.BadPattern (Pattern.boundVars pattern)
563 do detectDuplicates Error.BadPattern (Pattern.boundVars pattern)
564 return pattern
564 return pattern
@@ -568,7 +568,7 @@ validatePattern pattern =
568-- DETECT DUPLICATES
568-- DETECT DUPLICATES
571−checkDuplicates :: ValidStuff -> Result wrn ()
571+checkDuplicates :: ValidStuff -> Result w ()
572checkDuplicates (ValidStuff ports (D.Decls defs unions aliases _)) =
572checkDuplicates (ValidStuff ports (D.Decls defs unions aliases _)) =
574 -- SIMPLE NAMES
574 -- SIMPLE NAMES
@@ -608,7 +608,7 @@ checkDuplicates (ValidStuff ports (D.Decls defs unions aliases _)) =
611−detectDuplicates :: (Text -> Error.Error) -> [A.Located Text] -> Result wrn ()
611+detectDuplicates :: (Text -> Error.Error) -> [A.Located Text] -> Result w ()
612detectDuplicates tag names =
612detectDuplicates tag names =
614 add (A.A region name) dict =
614 add (A.A region name) dict =
@@ -632,7 +632,7 @@ detectDuplicates tag names =
632-- UNBOUND TYPE VARIABLES
632-- UNBOUND TYPE VARIABLES
635−checkTypeVarsInUnion :: A.Commented (D.Union Type.Raw) -> Result wrn ()
635+checkTypeVarsInUnion :: A.Commented (D.Union Type.Raw) -> Result w ()
636checkTypeVarsInUnion (A.A (region,_) (D.Type name boundVars ctors)) =
636checkTypeVarsInUnion (A.A (region,_) (D.Type name boundVars ctors)) =
637 do allFreeVars <- concat <$> traverse freeVars (concatMap snd ctors)
637 do allFreeVars <- concat <$> traverse freeVars (concatMap snd ctors)
638 case diff boundVars allFreeVars of
638 case diff boundVars allFreeVars of
@@ -644,7 +644,7 @@ checkTypeVarsInUnion (A.A (region,_) (D.Type name boundVars ctors)) =
644 (Error.UnboundTypeVarsInUnion name boundVars unbound)
644 (Error.UnboundTypeVarsInUnion name boundVars unbound)
647−checkTypeVarsInAlias :: A.Commented (D.Alias Type.Raw) -> Result wrn ()
647+checkTypeVarsInAlias :: A.Commented (D.Alias Type.Raw) -> Result w ()
648checkTypeVarsInAlias (A.A (region,_) (D.Type name boundVars tipe)) =
648checkTypeVarsInAlias (A.A (region,_) (D.Type name boundVars tipe)) =
649 do allFreeVars <- freeVars tipe
649 do allFreeVars <- freeVars tipe
650 case diff boundVars allFreeVars of
650 case diff boundVars allFreeVars of
@@ -678,7 +678,7 @@ diff left right =
681−freeVars :: Type.Raw -> Result wrn [A.Located Text]
681+freeVars :: Type.Raw -> Result w [A.Located Text]
682freeVars (A.A region tipe) =
682freeVars (A.A region tipe) =
683 case tipe of
683 case tipe of
684 Type.RLambda t1 t2 ->
684 Type.RLambda t1 t2 ->
@@ -696,7 +696,7 @@ freeVars (A.A region tipe) =
696 concat <$> traverse freeVars types
696 concat <$> traverse freeVars types
699−checkDuplicateFieldsInType :: Type.Raw -> Result wrn ()
699+checkDuplicateFieldsInType :: Type.Raw -> Result w ()
700checkDuplicateFieldsInType (A.A region tipe) =
700checkDuplicateFieldsInType (A.A region tipe) =
701 case tipe of
701 case tipe of
702 Type.RLambda t1 t2 ->
702 Type.RLambda t1 t2 ->