on master help sign in
cosmetic: rename wrn to w in type annotations
commit8171ead8c861ce1d4b8c39834221b0e1274b454c authorEvan Czaplicki <evancz@users.noreply.github.com> dateMon 4 Sep 2017, 15:24 (9 years ago) parentbca019d
1 file changed+30−30
src/Validate.hs+30−30
src/Validate.hs+30−30
@@ -36,7 +36,7 @@ type Result warning a =
3636-- MODULES
3737
3838
39−validate :: Module.Source -> Result wrn Module.Valid
39+validate :: Module.Source -> Result w Module.Valid
4040validate (Module.Module name info) =
4141 let
4242 (ModuleName.Canonical pkgName _) =
@@ -79,7 +79,7 @@ validateEffects
7979 -> Module.SourceSettings
8080 -> [A.Commented Effects.PortRaw]
8181 -> [A.Commented Src.ValidDef]
82− -> Result wrn Effects.Raw
82+ -> Result w Effects.Raw
8383validateEffects tag settings@(A.A _ pairs) ports validDefs =
8484 case tag of
8585 Module.Normal ->
@@ -105,7 +105,7 @@ validateEffects tag settings@(A.A _ pairs) ports validDefs =
105105 return (Effects.Manager () (Effects.Info tagRegion r0 r1 r2 managerType))
106106
107107
108−noSettings :: Error.Error -> Module.SourceSettings -> Result wrn ()
108+noSettings :: Error.Error -> Module.SourceSettings -> Result w ()
109109noSettings errorMsg (A.A region settings) =
110110 case settings of
111111 [] ->
@@ -115,7 +115,7 @@ noSettings errorMsg (A.A region settings) =
115115 Result.throw region errorMsg
116116
117117
118−noPorts :: [A.Commented Effects.PortRaw] -> Result wrn ()
118+noPorts :: [A.Commented Effects.PortRaw] -> Result w ()
119119noPorts ports =
120120 case ports of
121121 [] ->
@@ -132,7 +132,7 @@ noPorts ports =
132132toManagerType
133133 :: R.Region
134134 -> Map.Map Text [(R.Region, A.Located Text)]
135− -> Result wrn Effects.RawManagerType
135+ -> Result w Effects.RawManagerType
136136toManagerType tagRegion settingsDict =
137137 let
138138 toErrors name entries =
@@ -169,7 +169,7 @@ toManagerType tagRegion settingsDict =
169169extractOne
170170 :: Text
171171 -> Map.Map Text [(R.Region, A.Located Text)]
172− -> Result wrn (Maybe (A.Located Text))
172+ -> Result w (Maybe (A.Located Text))
173173extractOne name settingsDict =
174174 case Map.lookup name settingsDict of
175175 Nothing ->
@@ -193,7 +193,7 @@ checkManager
193193 :: R.Region
194194 -> Effects.RawManagerType
195195 -> [A.Commented Src.ValidDef]
196− -> Result wrn (R.Region, R.Region, R.Region)
196+ -> Result w (R.Region, R.Region, R.Region)
197197checkManager tagRegion managerType validDefs =
198198 let
199199 regionDict =
@@ -220,7 +220,7 @@ requireMaps
220220 :: R.Region
221221 -> Map.Map Text R.Region
222222 -> Effects.RawManagerType
223− -> Result wrn ()
223+ -> Result w ()
224224requireMaps tagRegion regionDict managerType =
225225 let
226226 check name =
@@ -238,7 +238,7 @@ requireMaps tagRegion regionDict managerType =
238238 check "cmdMap" <* check "subMap"
239239
240240
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
242242requireRegion tagRegion regionDict name =
243243 case Map.lookup name regionDict of
244244 Just region ->
@@ -252,7 +252,7 @@ requireRegion tagRegion regionDict name =
252252-- COLLAPSE COMMENTS
253253
254254
255−collapseComments :: [D.CommentOr (A.Located a)] -> Result wrn [A.Commented a]
255+collapseComments :: [D.CommentOr (A.Located a)] -> Result w [A.Commented a]
256256collapseComments listWithComments =
257257 case listWithComments of
258258 [] ->
@@ -282,7 +282,7 @@ collapseComments listWithComments =
282282-- VALIDATE STRUCTURED SOURCE
283283
284284
285−validateDecls :: [D.Source] -> Result wrn ValidStuff
285+validateDecls :: [D.Source] -> Result w ValidStuff
286286validateDecls sourceDecls =
287287 do rawDecls <- collapseComments sourceDecls
288288
@@ -307,7 +307,7 @@ data ValidStuff =
307307 }
308308
309309
310−validateRawDecls :: [A.Commented D.Raw] -> Result wrn ValidStuff
310+validateRawDecls :: [A.Commented D.Raw] -> Result w ValidStuff
311311validateRawDecls commentedDecls =
312312 vrdHelp commentedDecls [] (D.Decls [] [] [] [])
313313
@@ -316,7 +316,7 @@ vrdHelp
316316 :: [A.Commented D.Raw]
317317 -> [A.Commented Effects.PortRaw]
318318 -> D.Valid
319− -> Result wrn ValidStuff
319+ -> Result w ValidStuff
320320vrdHelp commentedDecls ports structure =
321321 case commentedDecls of
322322 [] ->
@@ -346,7 +346,7 @@ vrdDefHelp
346346 -> A.Commented Src.RawDef'
347347 -> [A.Commented Effects.PortRaw]
348348 -> D.Valid
349− -> Result wrn ValidStuff
349+ -> Result w ValidStuff
350350vrdDefHelp remainingDecls (A.A ann def) ports structure =
351351 let
352352 addDef validDef (ValidStuff finalPorts struct) =
@@ -375,7 +375,7 @@ vrdDefHelp remainingDecls (A.A ann def) ports structure =
375375-- VALIDATE DEFINITIONS
376376
377377
378−definitions :: [Src.RawDef] -> Result wrn [Src.ValidDef]
378+definitions :: [Src.RawDef] -> Result w [Src.ValidDef]
379379definitions sourceDefs =
380380 do validDefs <- definitionsHelp sourceDefs
381381
@@ -387,7 +387,7 @@ definitions sourceDefs =
387387 return validDefs
388388
389389
390−definitionsHelp :: [Src.RawDef] -> Result wrn [Src.ValidDef]
390+definitionsHelp :: [Src.RawDef] -> Result w [Src.ValidDef]
391391definitionsHelp sourceDefs =
392392 case sourceDefs of
393393 [] ->
@@ -415,7 +415,7 @@ validateDef
415415 -> Pattern.Raw
416416 -> Src.RawExpr
417417 -> Maybe Type.Raw
418− -> Result wrn Src.ValidDef
418+ -> Result w Src.ValidDef
419419validateDef region pat expr maybeType =
420420 do validExpr <- expression expr
421421 validateDefPattern pat validExpr
@@ -423,7 +423,7 @@ validateDef region pat expr maybeType =
423423 return $ Src.Def region pat validExpr maybeType
424424
425425
426−validateDefPattern :: Pattern.Raw -> Src.ValidExpr -> Result wrn ()
426+validateDefPattern :: Pattern.Raw -> Src.ValidExpr -> Result w ()
427427validateDefPattern pattern body =
428428 case fst (Src.collectLambdas body) of
429429 [] ->
@@ -442,7 +442,7 @@ validateDefPattern pattern body =
442442 Result.throw (R.merge start end) (Error.BadFunctionName (length args))
443443
444444
445−checkArguments :: Text -> [Pattern.Raw] -> Result wrn ()
445+checkArguments :: Text -> [Pattern.Raw] -> Result w ()
446446checkArguments funcName args =
447447 let
448448 vars =
@@ -462,7 +462,7 @@ checkArguments funcName args =
462462-- VALIDATE EXPRESSIONS
463463
464464
465−expression :: Src.RawExpr -> Result wrn Src.ValidExpr
465+expression :: Src.RawExpr -> Result w Src.ValidExpr
466466expression (A.A ann sourceExpression) =
467467 A.A ann <$>
468468 case sourceExpression of
@@ -532,17 +532,17 @@ expression (A.A ann sourceExpression) =
532532 return (Src.GLShader uid src gltipe)
533533
534534
535−second :: (a, Src.RawExpr) -> Result wrn (a, Src.ValidExpr)
535+second :: (a, Src.RawExpr) -> Result w (a, Src.ValidExpr)
536536second (value, expr) =
537537 (,) value <$> expression expr
538538
539539
540−both :: (Src.RawExpr, Src.RawExpr) -> Result wrn (Src.ValidExpr, Src.ValidExpr)
540+both :: (Src.RawExpr, Src.RawExpr) -> Result w (Src.ValidExpr, Src.ValidExpr)
541541both (expr1, expr2) =
542542 (,) <$> expression expr1 <*> expression expr2
543543
544544
545−checkDuplicateFields :: R.Region -> [(A.Located Text, a)] -> Result wrn ()
545+checkDuplicateFields :: R.Region -> [(A.Located Text, a)] -> Result w ()
546546checkDuplicateFields recordRegion fields =
547547 let
548548 checkDups seenFields ( A.A region field, _ ) =
@@ -558,7 +558,7 @@ checkDuplicateFields recordRegion fields =
558558-- VALIDATE PATTERNS
559559
560560
561−validatePattern :: Pattern.Raw -> Result wrn Pattern.Raw
561+validatePattern :: Pattern.Raw -> Result w Pattern.Raw
562562validatePattern pattern =
563563 do detectDuplicates Error.BadPattern (Pattern.boundVars pattern)
564564 return pattern
@@ -568,7 +568,7 @@ validatePattern pattern =
568568-- DETECT DUPLICATES
569569
570570
571−checkDuplicates :: ValidStuff -> Result wrn ()
571+checkDuplicates :: ValidStuff -> Result w ()
572572checkDuplicates (ValidStuff ports (D.Decls defs unions aliases _)) =
573573 let
574574 -- SIMPLE NAMES
@@ -608,7 +608,7 @@ checkDuplicates (ValidStuff ports (D.Decls defs unions aliases _)) =
608608 ]
609609
610610
611−detectDuplicates :: (Text -> Error.Error) -> [A.Located Text] -> Result wrn ()
611+detectDuplicates :: (Text -> Error.Error) -> [A.Located Text] -> Result w ()
612612detectDuplicates tag names =
613613 let
614614 add (A.A region name) dict =
@@ -632,7 +632,7 @@ detectDuplicates tag names =
632632-- UNBOUND TYPE VARIABLES
633633
634634
635−checkTypeVarsInUnion :: A.Commented (D.Union Type.Raw) -> Result wrn ()
635+checkTypeVarsInUnion :: A.Commented (D.Union Type.Raw) -> Result w ()
636636checkTypeVarsInUnion (A.A (region,_) (D.Type name boundVars ctors)) =
637637 do allFreeVars <- concat <$> traverse freeVars (concatMap snd ctors)
638638 case diff boundVars allFreeVars of
@@ -644,7 +644,7 @@ checkTypeVarsInUnion (A.A (region,_) (D.Type name boundVars ctors)) =
644644 (Error.UnboundTypeVarsInUnion name boundVars unbound)
645645
646646
647−checkTypeVarsInAlias :: A.Commented (D.Alias Type.Raw) -> Result wrn ()
647+checkTypeVarsInAlias :: A.Commented (D.Alias Type.Raw) -> Result w ()
648648checkTypeVarsInAlias (A.A (region,_) (D.Type name boundVars tipe)) =
649649 do allFreeVars <- freeVars tipe
650650 case diff boundVars allFreeVars of
@@ -678,7 +678,7 @@ diff left right =
678678 )
679679
680680
681−freeVars :: Type.Raw -> Result wrn [A.Located Text]
681+freeVars :: Type.Raw -> Result w [A.Located Text]
682682freeVars (A.A region tipe) =
683683 case tipe of
684684 Type.RLambda t1 t2 ->
@@ -696,7 +696,7 @@ freeVars (A.A region tipe) =
696696 concat <$> traverse freeVars types
697697
698698
699−checkDuplicateFieldsInType :: Type.Raw -> Result wrn ()
699+checkDuplicateFieldsInType :: Type.Raw -> Result w ()
700700checkDuplicateFieldsInType (A.A region tipe) =
701701 case tipe of
702702 Type.RLambda t1 t2 ->