@@ -1,5 +1,5 @@
1{-# OPTIONS_GHC -Wno-unused-do-bind #-}
1{-# OPTIONS_GHC -Wno-unused-do-bind #-}
2−{-# LANGUAGE BangPatterns #-}
2+{-# LANGUAGE BangPatterns, OverloadedStrings #-}
3module Build
3module Build
4 ( fromExposed
4 ( fromExposed
5 , fromMains
5 , fromMains
@@ -26,6 +26,7 @@ import qualified Data.Maybe as Maybe
26import qualified Data.Name as Name
26import qualified Data.Name as Name
27import qualified Data.NonEmptyList as NE
27import qualified Data.NonEmptyList as NE
28import qualified Data.OneOrMore as OneOrMore
28import qualified Data.OneOrMore as OneOrMore
29+import qualified Data.Set as Set
29import qualified System.Directory as Dir
30import qualified System.Directory as Dir
30import qualified System.FilePath as FP
31import qualified System.FilePath as FP
31import System.FilePath ((</>), (<.>))
32import System.FilePath ((</>), (<.>))
@@ -42,9 +43,10 @@ import qualified File
42import qualified Parse.Module as Parse
43import qualified Parse.Module as Parse
43import qualified Reporting
44import qualified Reporting
44import qualified Reporting.Annotation as A
45import qualified Reporting.Annotation as A
46+import qualified Reporting.Error as Error
47+import qualified Reporting.Error.Syntax as Syntax
48+import qualified Reporting.Error.Import as Import
45import qualified Reporting.Exit as Exit
49import qualified Reporting.Exit as Exit
46−import qualified Reporting.Problem as Problem
47−import qualified Reporting.Render.Type.Localizer as Localizer
48import qualified Stuff
50import qualified Stuff
@@ -172,7 +174,7 @@ fromMains style root details paths =
172 rmvar <- newEmptyMVar
174 rmvar <- newEmptyMVar
173 resultsMVars <- forkWithKey (checkModule env foreigns rmvar) statuses
175 resultsMVars <- forkWithKey (checkModule env foreigns rmvar) statuses
174 putMVar rmvar resultsMVars
176 putMVar rmvar resultsMVars
175− rmainMVars <- traverse (fork . checkMain env resultsMVars) smains
177+ rmainMVars <- traverse (fork . checkMain env foreigns resultsMVars) smains
176 results <- traverse readMVar resultsMVars
178 results <- traverse readMVar resultsMVars
177 writeDetails root details results
179 writeDetails root details results
178 toArtifacts env foreigns results <$> traverse readMVar rmainMVars
180 toArtifacts env foreigns results <$> traverse readMVar rmainMVars
@@ -189,8 +191,8 @@ type StatusDict =
189data Status
191data Status
190 = SCached Details.Local
192 = SCached Details.Local
191 | SChanged Details.Local B.ByteString Src.Module
193 | SChanged Details.Local B.ByteString Src.Module
192− | SBadImport Problem.Import
194+ | SBadImport Import.Problem
193− | SBadSyntax Problem.Syntax
195+ | SBadSyntax FilePath File.Time B.ByteString Syntax.Error
194 | SForeign Pkg.Name
196 | SForeign Pkg.Name
195 | SKernel
197 | SKernel
@@ -219,7 +221,7 @@ crawlModule env@(Env _ root pkg srcDirs locals foreigns) mvar name =
219 [path] ->
221 [path] ->
220 case Map.lookup name foreigns of
222 case Map.lookup name foreigns of
221 Just (Details.Foreign dep deps) ->
223 Just (Details.Foreign dep deps) ->
222− return $ SBadImport $ Import.Ambiguous name path [] dep deps
224+ return $ SBadImport $ Import.Ambiguous path [] dep deps
224 Nothing ->
226 Nothing ->
225 case Map.lookup name locals of
227 case Map.lookup name locals of
@@ -236,7 +238,7 @@ crawlModule env@(Env _ root pkg srcDirs locals foreigns) mvar name =
236 else crawlDeps env mvar deps (SCached local)
238 else crawlDeps env mvar deps (SCached local)
238 p1:p2:ps ->
240 p1:p2:ps ->
239− return $ SBadImport $ Import.AmbiguousLocal name p1 p2 ps
241+ return $ SBadImport $ Import.AmbiguousLocal p1 p2 ps
242 case Map.lookup name foreigns of
244 case Map.lookup name foreigns of
@@ -246,14 +248,14 @@ crawlModule env@(Env _ root pkg srcDirs locals foreigns) mvar name =
246 return $ SForeign dep
248 return $ SForeign dep
249− return $ SBadImport $ Import.AmbiguousForeign name dep d ds
251+ return $ SBadImport $ Import.AmbiguousForeign dep d ds
251 Nothing ->
253 Nothing ->
252 if Name.isKernel name && Pkg.isKernel pkg then
254 if Name.isKernel name && Pkg.isKernel pkg then
253 do exists <- File.exists ("src" </> ModuleName.toFilePath name <.> "js")
255 do exists <- File.exists ("src" </> ModuleName.toFilePath name <.> "js")
254− return $ if exists then SKernel else SBadImport (Import.NotFound name)
256+ return $ if exists then SKernel else SBadImport Import.NotFound
256− return $ SBadImport (Import.NotFound name)
258+ return $ SBadImport Import.NotFound
259crawlFile :: Env -> MVar StatusDict -> ModuleName.Raw -> FilePath -> IO Status
261crawlFile :: Env -> MVar StatusDict -> ModuleName.Raw -> FilePath -> IO Status
@@ -262,9 +264,15 @@ crawlFile env@(Env _ root pkg _ _ _) mvar expectedName path =
262 source <- File.readUtf8 (root </> path)
264 source <- File.readUtf8 (root </> path)
264 case Parse.fromByteString pkg source of
266 case Parse.fromByteString pkg source of
268+ return $ SBadSyntax path time source err
265 Right modul@(Src.Module maybeActualName _ imports values _ _ _ _) ->
270 Right modul@(Src.Module maybeActualName _ imports values _ _ _ _) ->
266 case maybeActualName of
271 case maybeActualName of
273+ return $ SBadSyntax path time source (Syntax.ModuleNameUnspecified expectedName)
267− Just actualName ->
275+ Just name@(A.At _ actualName) ->
268 if expectedName == actualName then
276 if expectedName == actualName then
270 deps = map Src.getImportName imports
278 deps = map Src.getImportName imports
@@ -272,13 +280,7 @@ crawlFile env@(Env _ root pkg _ _ _) mvar expectedName path =
273 crawlDeps env mvar deps (SChanged local source modul)
281 crawlDeps env mvar deps (SChanged local source modul)
275− return $ SBadSyntax $ Problem.ModuleNameMismatch expectedName actualName
283+ return $ SBadSyntax path time source (Syntax.ModuleNameMismatch expectedName name)
278− return $ SBadSyntax $ Problem.ModuleNameUnspecified expectedName
281− return $ SBadSyntax $ Problem.SyntaxProblem path time syntaxError
284isMain :: A.Located Src.Value -> Bool
286isMain :: A.Located Src.Value -> Bool
@@ -298,8 +300,8 @@ data Result
298 = RNew Details.Local I.Interface Opt.LocalGraph
300 = RNew Details.Local I.Interface Opt.LocalGraph
299 | RSame Details.Local I.Interface Opt.LocalGraph
301 | RSame Details.Local I.Interface Opt.LocalGraph
300 | RCached Bool (MVar CachedInterface)
302 | RCached Bool (MVar CachedInterface)
301− | RNotFound Problem.Import
303+ | RNotFound Import.Problem
302− | RProblem Problem.Problem
304+ | RProblem Error.Module
303 | RBlocked
305 | RBlocked
304 | RForeign I.Interface
306 | RForeign I.Interface
305 | RKernel
307 | RKernel
@@ -322,9 +324,9 @@ checkModule env@(Env _ root pkg _ _ _) foreigns resultsMVar name status =
322 do source <- File.readUtf8 path
324 do source <- File.readUtf8 path
323 case Parse.fromByteString pkg source of
325 case Parse.fromByteString pkg source of
324 Right modul -> compile env local source ifaces modul
326 Right modul -> compile env local source ifaces modul
325− Left syntaxError ->
327+ Left err ->
326− return $ RProblem $ Problem.BadSyntax $
328+ return $ RProblem $
327− Problem.SyntaxProblem path time syntaxError
329+ Error.Module name path time source (Error.BadSyntax err)
329 DepsSame _ _ ->
331 DepsSame _ _ ->
330 do mvar <- newMVar Unneeded
332 do mvar <- newMVar Unneeded
@@ -333,10 +335,17 @@ checkModule env@(Env _ root pkg _ _ _) foreigns resultsMVar name status =
333 DepsBlock ->
335 DepsBlock ->
334 return RBlocked
336 return RBlocked
336− DepsNotFound name1 problem1 others ->
338+ DepsNotFound problems ->
337− return (RProblem (Problem.BadImports name1 problem1 others))
339+ do source <- File.readUtf8 path
340+ return $ RProblem $ Error.Module name path time source $
341+ case Parse.fromByteString pkg source of
342+ Right (Src.Module _ _ imports _ _ _ _ _) ->
343+ Error.BadImports (toImportErrors foreigns results imports problems)
339− SChanged local@(Details.Local _ _ deps _) source modul ->
348+ SChanged local@(Details.Local path time deps _) source modul@(Src.Module _ _ imports _ _ _ _ _) ->
340 do results <- readMVar resultsMVar
349 do results <- readMVar resultsMVar
341 depsStatus <- checkDeps root results deps
350 depsStatus <- checkDeps root results deps
342 case depsStatus of
351 case depsStatus of
@@ -356,14 +365,16 @@ checkModule env@(Env _ root pkg _ _ _) foreigns resultsMVar name status =
356 DepsBlock ->
365 DepsBlock ->
357 return RBlocked
366 return RBlocked
359− DepsNotFound name1 problem1 others ->
368+ DepsNotFound problems ->
360− return (RProblem (Problem.BadImports name1 problem1 others))
369+ return $ RProblem $ Error.Module name path time source $
370+ Error.BadImports (toImportErrors foreigns results imports problems)
362 SBadImport importProblem ->
372 SBadImport importProblem ->
363 return (RNotFound importProblem)
373 return (RNotFound importProblem)
365− SBadSyntax syntaxProblem ->
375+ SBadSyntax path time source err ->
366− return (RProblem (Problem.BadSyntax syntaxProblem))
376+ return $ RProblem $ Error.Module name path time source $
368 SForeign home ->
379 SForeign home ->
369 case foreigns ! ModuleName.Canonical home name of
380 case foreigns ! ModuleName.Canonical home name of
@@ -382,7 +393,7 @@ data DepsStatus
382 = DepsChange (Map.Map ModuleName.Raw I.Interface)
393 = DepsChange (Map.Map ModuleName.Raw I.Interface)
383 | DepsSame [Dep] [CDep]
394 | DepsSame [Dep] [CDep]
384 | DepsBlock
395 | DepsBlock
385− | DepsNotFound ModuleName.Raw Problem.Import [(ModuleName.Raw, Problem.Import)]
396+ | DepsNotFound (NE.List (ModuleName.Raw, Import.Problem))
388checkDeps :: FilePath -> ResultDict -> [ModuleName.Raw] -> IO DepsStatus
399checkDeps :: FilePath -> ResultDict -> [ModuleName.Raw] -> IO DepsStatus
@@ -394,25 +405,25 @@ type Dep = (ModuleName.Raw, I.Interface)
394type CDep = (ModuleName.Raw, MVar CachedInterface)
405type CDep = (ModuleName.Raw, MVar CachedInterface)
397−checkDepsHelp :: FilePath -> ResultDict -> [ModuleName.Raw] -> [Dep] -> [Dep] -> [CDep] -> [(ModuleName.Raw, Problem.Import)] -> Bool -> IO DepsStatus
408+checkDepsHelp :: FilePath -> ResultDict -> [ModuleName.Raw] -> [Dep] -> [Dep] -> [CDep] -> [(ModuleName.Raw,Import.Problem)] -> Bool -> IO DepsStatus
398−checkDepsHelp root results deps new same cached badImports isBlocked =
409+checkDepsHelp root results deps new same cached importProblems isBlocked =
399 case deps of
410 case deps of
400 dep:otherDeps ->
411 dep:otherDeps ->
401 do result <- readMVar (results ! dep)
412 do result <- readMVar (results ! dep)
402 case result of
413 case result of
403− RNew _ iface _ -> checkDepsHelp root results otherDeps ((dep,iface) : new) same cached badImports isBlocked
414+ RNew _ iface _ -> checkDepsHelp root results otherDeps ((dep,iface) : new) same cached importProblems isBlocked
404− RSame _ iface _ -> checkDepsHelp root results otherDeps new ((dep,iface) : same) cached badImports isBlocked
415+ RSame _ iface _ -> checkDepsHelp root results otherDeps new ((dep,iface) : same) cached importProblems isBlocked
405− RCached _ mvar -> checkDepsHelp root results otherDeps new same ((dep,mvar) : cached) badImports isBlocked
416+ RCached _ mvar -> checkDepsHelp root results otherDeps new same ((dep,mvar) : cached) importProblems isBlocked
406− RNotFound prob -> checkDepsHelp root results otherDeps new same cached ((dep,prob) : badImports) True
417+ RNotFound prob -> checkDepsHelp root results otherDeps new same cached ((dep,prob) : importProblems) True
407− RProblem _ -> checkDepsHelp root results otherDeps new same cached badImports True
418+ RProblem _ -> checkDepsHelp root results otherDeps new same cached importProblems True
408− RBlocked -> checkDepsHelp root results otherDeps new same cached badImports True
419+ RBlocked -> checkDepsHelp root results otherDeps new same cached importProblems True
409− RForeign iface -> checkDepsHelp root results otherDeps new ((dep,iface) : same) cached badImports isBlocked
420+ RForeign iface -> checkDepsHelp root results otherDeps new ((dep,iface) : same) cached importProblems isBlocked
410− RKernel -> checkDepsHelp root results otherDeps new same cached badImports isBlocked
421+ RKernel -> checkDepsHelp root results otherDeps new same cached importProblems isBlocked
413− case badImports of
424+ case importProblems of
414− (name, problem) : otherBadImports ->
425+ p:ps ->
415− return $ DepsNotFound name problem otherBadImports
426+ return $ DepsNotFound (NE.List p ps)
418 if isBlocked then
429 if isBlocked then
@@ -433,6 +444,27 @@ checkDepsHelp root results deps new same cached badImports isBlocked =
450+toImportErrors :: Dependencies -> ResultDict -> [Src.Import] -> NE.List (ModuleName.Raw, Import.Problem) -> NE.List Import.Error
451+toImportErrors foreigns results imports problems =
455+ (Set.fromList (map ModuleName._module (Map.keys foreigns)))
456+ (Map.keysSet results)
459+ Map.fromList (map (\(Src.Import (A.At region name) _ _) -> (name, region)) imports)
461+ toError (name, problem) =
462+ Import.Error (regionDict ! name) name knownModules problem
464+ fmap toError problems
436-- CACHED INTERFACE
468-- CACHED INTERFACE
@@ -543,7 +575,7 @@ addToGraph name status graph =
543 SCached (Details.Local _ _ deps _) -> deps
575 SCached (Details.Local _ _ deps _) -> deps
544 SChanged (Details.Local _ _ deps _) _ _ -> deps
576 SChanged (Details.Local _ _ deps _) _ _ -> deps
545 SBadImport _ -> []
577 SBadImport _ -> []
546− SBadSyntax _ -> []
578+ SBadSyntax _ _ _ _ -> []
547 SForeign _ -> []
579 SForeign _ -> []
548 SKernel -> []
580 SKernel -> []
@@ -591,7 +623,7 @@ checkInside name p1 status =
591 SCached (Details.Local p2 _ _ _) -> Left (Exit.BP_MainNameDuplicate name p1 p2)
623 SCached (Details.Local p2 _ _ _) -> Left (Exit.BP_MainNameDuplicate name p1 p2)
592 SChanged (Details.Local p2 _ _ _) _ _ -> Left (Exit.BP_MainNameDuplicate name p1 p2)
624 SChanged (Details.Local p2 _ _ _) _ _ -> Left (Exit.BP_MainNameDuplicate name p1 p2)
593 SBadImport _ -> Right ()
625 SBadImport _ -> Right ()
594− SBadSyntax _ -> Right ()
626+ SBadSyntax _ _ _ _ -> Right ()
595 SForeign _ -> Right ()
627 SForeign _ -> Right ()
596 SKernel -> Right ()
628 SKernel -> Right ()
@@ -621,10 +653,10 @@ compile (Env key root pkg _ _ _) local@(Details.Local path time _ _) source ifac
621 Reporting.report key Reporting.BDone
653 Reporting.report key Reporting.BDone
622 return (RNew local iface objects)
654 return (RNew local iface objects)
624− Left errors ->
656+ Left err ->
625 do Reporting.report key Reporting.BDone
657 do Reporting.report key Reporting.BDone
626− return $ RProblem $ Problem.BadContent $
658+ return $ RProblem $
627− Problem.Module (Src.getName modul) path time source errors (Localizer.fromModule modul)
659+ Error.Module (Src.getName modul) path time source err
@@ -656,22 +688,22 @@ addNewLocal name result locals =
657detectProblems :: Map.Map ModuleName.Raw Result -> Either Exit.BuildProblem ()
689detectProblems :: Map.Map ModuleName.Raw Result -> Either Exit.BuildProblem ()
658detectProblems results =
690detectProblems results =
659− case Map.foldr addProblem [] results of
691+ case Map.foldr addErrors [] results of
660 [] -> Right ()
692 [] -> Right ()
661− p:ps -> Left (Exit.BuildModuleProblems p ps)
693+ e:es -> Left (Exit.BuildModuleProblems e es)
664−addProblem :: Result -> [Problem.Problem] -> [Problem.Problem]
696+addErrors :: Result -> [Error.Module] -> [Error.Module]
665−addProblem result problems =
697+addErrors result errors =
666 case result of
698 case result of
667− RNew _ _ _ -> problems
699+ RNew _ _ _ -> errors
668− RSame _ _ _ -> problems
700+ RSame _ _ _ -> errors
669− RCached _ _ -> problems
701+ RCached _ _ -> errors
670− RNotFound _ -> problems
702+ RNotFound _ -> errors
671− RProblem p -> p:problems
703+ RProblem e -> e:errors
672− RBlocked -> problems
704+ RBlocked -> errors
673− RForeign _ -> problems
705+ RForeign _ -> errors
674− RKernel -> problems
706+ RKernel -> errors
@@ -804,7 +836,7 @@ dropPrefix roots paths =
804data MainStatus
836data MainStatus
805 = SInside ModuleName.Raw
837 = SInside ModuleName.Raw
806 | SOutsideOk Details.Local B.ByteString Src.Module
838 | SOutsideOk Details.Local B.ByteString Src.Module
807− | SOutsideErr Problem.Syntax
839+ | SOutsideErr Error.Module
810crawlMain :: Env -> MVar StatusDict -> MainLocation -> IO MainStatus
842crawlMain :: Env -> MVar StatusDict -> MainLocation -> IO MainStatus
@@ -827,7 +859,8 @@ crawlMain env@(Env _ _ pkg _ _ _) mvar given =
827 crawlDeps env mvar deps (SOutsideOk local source modul)
859 crawlDeps env mvar deps (SOutsideOk local source modul)
829 Left syntaxError ->
861 Left syntaxError ->
830− return (SOutsideErr (Problem.SyntaxProblem path time syntaxError))
862+ return $ SOutsideErr $
863+ Error.Module "???" path time source (Error.BadSyntax syntaxError)
@@ -837,20 +870,20 @@ crawlMain env@(Env _ _ pkg _ _ _) mvar given =
837data MainResult
870data MainResult
838 = RInside ModuleName.Raw
871 = RInside ModuleName.Raw
839 | ROutsideOk ModuleName.Raw I.Interface Opt.LocalGraph
872 | ROutsideOk ModuleName.Raw I.Interface Opt.LocalGraph
840− | ROutsideErr Problem.Problem
873+ | ROutsideErr Error.Module
841 | ROutsideBlocked
874 | ROutsideBlocked
844−checkMain :: Env -> ResultDict -> MainStatus -> IO MainResult
877+checkMain :: Env -> Dependencies -> ResultDict -> MainStatus -> IO MainResult
845−checkMain env@(Env _ root _ _ _ _) results pendingMain =
878+checkMain env@(Env _ root _ _ _ _) foreigns results pendingMain =
846 case pendingMain of
879 case pendingMain of
847 SInside name ->
880 SInside name ->
848 return (RInside name)
881 return (RInside name)
850− SOutsideErr syntaxProblem ->
883+ SOutsideErr err ->
851− return (ROutsideErr (Problem.BadSyntax syntaxProblem))
884+ return (ROutsideErr err)
853− SOutsideOk local@(Details.Local _ _ deps _) source modul ->
886+ SOutsideOk local@(Details.Local path time deps _) source modul@(Src.Module _ _ imports _ _ _ _ _) ->
854 do depsStatus <- checkDeps root results deps
887 do depsStatus <- checkDeps root results deps
855 case depsStatus of
888 case depsStatus of
856 DepsChange ifaces ->
889 DepsChange ifaces ->
@@ -869,8 +902,9 @@ checkMain env@(Env _ root _ _ _ _) results pendingMain =
869 DepsBlock ->
902 DepsBlock ->
870 return ROutsideBlocked
903 return ROutsideBlocked
872− DepsNotFound name1 problem1 others ->
905+ DepsNotFound problems ->
873− return (ROutsideErr (Problem.BadImports name1 problem1 others))
906+ return $ ROutsideErr $ Error.Module (Src.getName modul) path time source $
907+ Error.BadImports (toImportErrors foreigns results imports problems)
876compileOutside :: Env -> Details.Local -> B.ByteString -> Map.Map ModuleName.Raw I.Interface -> Src.Module -> MainResult
910compileOutside :: Env -> Details.Local -> B.ByteString -> Map.Map ModuleName.Raw I.Interface -> Src.Module -> MainResult
@@ -883,8 +917,8 @@ compileOutside (Env _ _ pkg _ _ _) (Details.Local path time _ _) source ifaces m
883 ROutsideOk name (I.fromModule pkg canonical annotations) objects
917 ROutsideOk name (I.fromModule pkg canonical annotations) objects
885 Left errors ->
919 Left errors ->
886− ROutsideErr $ Problem.BadContent $
920+ ROutsideErr $
887− Problem.Module name path time source errors (Localizer.fromModule modul)
921+ Error.Module name path time source errors
@@ -899,34 +933,34 @@ data Main
899toArtifacts :: Env -> Dependencies -> Map.Map ModuleName.Raw Result -> NE.List MainResult -> Either Exit.BuildProblem Artifacts
933toArtifacts :: Env -> Dependencies -> Map.Map ModuleName.Raw Result -> NE.List MainResult -> Either Exit.BuildProblem Artifacts
900toArtifacts (Env _ _ pkg _ _ _) foreigns results mainResults =
934toArtifacts (Env _ _ pkg _ _ _) foreigns results mainResults =
901 case gatherProblemsOrMains results mainResults of
935 case gatherProblemsOrMains results mainResults of
902− Left (NE.List p ps) ->
936+ Left (NE.List e es) ->
903− Left (Exit.BuildModuleProblems p ps)
937+ Left (Exit.BuildModuleProblems e es)
905 Right mains ->
939 Right mains ->
906 Right $ Artifacts pkg foreigns mains $
940 Right $ Artifacts pkg foreigns mains $
907 Map.foldrWithKey addInside (foldr addOutside [] mainResults) results
941 Map.foldrWithKey addInside (foldr addOutside [] mainResults) results
910−gatherProblemsOrMains :: Map.Map ModuleName.Raw Result -> NE.List MainResult -> Either (NE.List Problem.Problem) (NE.List Main)
944+gatherProblemsOrMains :: Map.Map ModuleName.Raw Result -> NE.List MainResult -> Either (NE.List Error.Module) (NE.List Main)
911gatherProblemsOrMains results (NE.List mainResult mainResults) =
945gatherProblemsOrMains results (NE.List mainResult mainResults) =
913− sortMain result (ps, mains) =
947+ sortMain result (es, mains) =
914 case result of
948 case result of
915− RInside n -> ( ps, Inside n : mains)
949+ RInside n -> ( es, Inside n : mains)
916− ROutsideOk n i o -> ( ps, Outside n i o : mains)
950+ ROutsideOk n i o -> ( es, Outside n i o : mains)
917− ROutsideErr p -> (p:ps, mains)
951+ ROutsideErr e -> (e:es, mains)
918− ROutsideBlocked -> ( ps, mains)
952+ ROutsideBlocked -> ( es, mains)
920− problems = Map.foldr addProblem [] results
954+ errors = Map.foldr addErrors [] results
922− case (mainResult, foldr sortMain (problems, []) mainResults) of
956+ case (mainResult, foldr sortMain (errors, []) mainResults) of
923 (RInside n , ( [], ms)) -> Right (NE.List (Inside n) ms)
957 (RInside n , ( [], ms)) -> Right (NE.List (Inside n) ms)
924− (RInside _ , (p:ps, _ )) -> Left (NE.List p ps)
958+ (RInside _ , (e:es, _ )) -> Left (NE.List e es)
925 (ROutsideOk n i o, ( [], ms)) -> Right (NE.List (Outside n i o) ms)
959 (ROutsideOk n i o, ( [], ms)) -> Right (NE.List (Outside n i o) ms)
926− (ROutsideOk _ _ _, (p:ps, _ )) -> Left (NE.List p ps)
960+ (ROutsideOk _ _ _, (e:es, _ )) -> Left (NE.List e es)
927− (ROutsideErr p , ( ps, _ )) -> Left (NE.List p ps)
961+ (ROutsideErr e , ( es, _ )) -> Left (NE.List e es)
928 (ROutsideBlocked , ( [], _ )) -> error "seems like elm-stuff/ is corrupted"
962 (ROutsideBlocked , ( [], _ )) -> error "seems like elm-stuff/ is corrupted"
929− (ROutsideBlocked , (p:ps, _ )) -> Left (NE.List p ps)
963+ (ROutsideBlocked , (e:es, _ )) -> Left (NE.List e es)
932addInside :: ModuleName.Raw -> Result -> [Module] -> [Module]
966addInside :: ModuleName.Raw -> Result -> [Module] -> [Module]