@@ -17,14 +17,14 @@ import Elm.Utils ((|>))
1717import qualified Reporting.Annotation as A
1818import qualified Reporting.Error.Syntax as Error
1919import qualified Reporting.Region as R
20−import qualified Reporting.Task as Task
20+import qualified Reporting.Result as Result
2121
2222
2323-- VALIDATE DECLARATIONS
2424
2525declarations
2626 :: [D.SourceDecl]
27− -> Task.Task wrn Error.Error [D.ValidDecl]
27+ -> Result.Result wrn Error.Error [D.ValidDecl]
2828declarations sourceDecls =
2929 do validDecls <- validateDecls sourceDecls
3030 (\_ _ -> validDecls)
@@ -34,7 +34,7 @@ declarations sourceDecls =
3434
3535validateDecls
3636 :: [D.SourceDecl]
37− -> Task.Task wrn Error.Error [D.ValidDecl]
37+ -> Result.Result wrn Error.Error [D.ValidDecl]
3838validateDecls sourceDecls =
3939 case sourceDecls of
4040 [] ->
@@ -47,7 +47,7 @@ validateDecls sourceDecls =
4747validateDeclsHelp
4848 :: D.SourceDecl
4949 -> [D.SourceDecl]
50− -> Task.Task wrn Error.Error [D.ValidDecl]
50+ -> Result.Result wrn Error.Error [D.ValidDecl]
5151validateDeclsHelp (A.A region decl) decls =
5252 let addRest validDecl =
5353 (:) (A.A region validDecl) <$> validateDecls decls
@@ -74,7 +74,7 @@ validateDeclsHelp (A.A region decl) decls =
7474defHelp
7575 :: Source.Def
7676 -> [D.SourceDecl]
77− -> Task.Task wrn Error.Error [D.ValidDecl]
77+ -> Result.Result wrn Error.Error [D.ValidDecl]
7878defHelp (A.A region def) decls =
7979 let addRest def' rest =
8080 (:) (A.A region (D.Definition def')) <$> validateDecls rest
@@ -94,7 +94,7 @@ defHelp (A.A region def) decls =
9494 addRest def' rest
9595
9696 _ ->
97− Task.throw region (Error.TypeWithoutDefinition name)
97+ Result.throw region (Error.TypeWithoutDefinition name)
9898
9999
100100-- VALIDATE PORTS IN DECLARATIONS
@@ -103,14 +103,14 @@ portHelp
103103 :: R.Region
104104 -> D.SourcePort
105105 -> [D.SourceDecl]
106− -> Task.Task wrn Error.Error [D.ValidDecl]
106+ -> Result.Result wrn Error.Error [D.ValidDecl]
107107portHelp region port decls =
108108 let addRest port' rest =
109109 (:) (A.A region (D.Port port')) <$> validateDecls rest
110110 in
111111 case port of
112112 D.PortDefinition name _ ->
113− Task.throw region (Error.PortWithoutAnnotation name)
113+ Result.throw region (Error.PortWithoutAnnotation name)
114114
115115 D.PortAnnotation name tipe ->
116116 case decls of
@@ -126,7 +126,7 @@ portHelp region port decls =
126126
127127-- VALIDATE DEFINITIONS
128128
129−definitions :: [Source.Def] -> Task.Task wrn Error.Error [Valid.Def]
129+definitions :: [Source.Def] -> Result.Result wrn Error.Error [Valid.Def]
130130definitions sourceDefs =
131131 do validDefs <- definitionsHelp sourceDefs
132132 let patterns = map (\(Valid.Definition p _ _) -> p) validDefs
@@ -134,7 +134,7 @@ definitions sourceDefs =
134134 return validDefs
135135
136136
137−definitionsHelp :: [Source.Def] -> Task.Task wrn Error.Error [Valid.Def]
137+definitionsHelp :: [Source.Def] -> Result.Result wrn Error.Error [Valid.Def]
138138definitionsHelp sourceDefs =
139139 case sourceDefs of
140140 [] ->
@@ -154,12 +154,12 @@ definitionsHelp sourceDefs =
154154 (:) def <$> definitionsHelp rest'
155155
156156 _ ->
157− Task.throw region (Error.TypeWithoutDefinition name)
157+ Result.throw region (Error.TypeWithoutDefinition name)
158158
159159
160160-- VALIDATE EXPRESSIONS
161161
162−expression :: Source.Expr -> Task.Task wrn Error.Error Valid.Expr
162+expression :: Source.Expr -> Result.Result wrn Error.Error Valid.Expr
163163expression (A.A ann sourceExpression) =
164164 A.A ann <$>
165165 case sourceExpression of
@@ -250,14 +250,14 @@ expression (A.A ann sourceExpression) =
250250 return (Task name expr' tipe)
251251
252252
253−second :: (a, Source.Expr) -> Task.Task wrn Error.Error (a, Valid.Expr)
253+second :: (a, Source.Expr) -> Result.Result wrn Error.Error (a, Valid.Expr)
254254second (value, expr) =
255255 (,) value <$> expression expr
256256
257257
258258both
259259 :: (Source.Expr, Source.Expr)
260− -> Task.Task wrn Error.Error (Valid.Expr, Valid.Expr)
260+ -> Result.Result wrn Error.Error (Valid.Expr, Valid.Expr)
261261both (expr1, expr2) =
262262 (,) <$> expression expr1 <*> expression expr2
263263
@@ -267,7 +267,7 @@ both (expr1, expr2) =
267267detectDuplicates
268268 :: (String -> Error.Error)
269269 -> [A.Located String]
270− -> Task.Task wrn Error.Error ()
270+ -> Result.Result wrn Error.Error ()
271271detectDuplicates tag names =
272272 let add (A.A region name) dict =
273273 Map.insertWith (++) name [region] dict
@@ -278,7 +278,7 @@ detectDuplicates tag names =
278278 check (name, regions) =
279279 case regions of
280280 _ : region : _ ->
281− Task.throw region (tag name)
281+ Result.throw region (tag name)
282282
283283 _ ->
284284 return ()
@@ -288,13 +288,13 @@ detectDuplicates tag names =
288288
289289defDuplicates
290290 :: [Pattern.RawPattern]
291− -> Task.Task wrn Error.Error ()
291+ -> Result.Result wrn Error.Error ()
292292defDuplicates patterns =
293293 concatMap Pattern.boundVars patterns
294294 |> detectDuplicates Error.DuplicateDefinition
295295
296296
297−declDuplicates :: [D.ValidDecl] -> Task.Task wrn Error.Error ()
297+declDuplicates :: [D.ValidDecl] -> Result.Result wrn Error.Error ()
298298declDuplicates decls =
299299 let (valueLists, typeLists) = unzip (map extractValues decls)
300300 in
@@ -339,7 +339,7 @@ extractValues (A.A region decl) =
339339
340340-- UNBOUND TYPE VARIABLES
341341
342−checkDecl :: D.ValidDecl -> Task.Task wrn Error.Error ()
342+checkDecl :: D.ValidDecl -> Result.Result wrn Error.Error ()
343343checkDecl (A.A _ decl) =
344344 case decl of
345345 D.Definition _ ->
@@ -358,14 +358,14 @@ checkDecl (A.A _ decl) =
358358 return ()
359359
360360
361−checkTypeVars :: String -> [String] -> Type.Raw -> Task.Task wrn Error.Error ()
361+checkTypeVars :: String -> [String] -> Type.Raw -> Result.Result wrn Error.Error ()
362362checkTypeVars name boundVars tipe =
363363 let bounds = Set.fromList boundVars
364364
365365 check (A.A region free) =
366366 if Set.member free bounds
367367 then return ()
368− else Task.throw region (Error.UnboundTypeVar name free)
368+ else Result.throw region (Error.UnboundTypeVar name free)
369369 in
370370 F.traverse_ check (freeVars tipe)
371371