@@ -2,7 +2,6 @@
22
33module Language.PureScript.Docs.ParseAndDesugar
44 ( parseAndDesugar
5− , ParseDesugarError(..)
65 ) where
76
87import Prelude ()
@@ -24,12 +23,6 @@ import qualified Language.PureScript.Constants as C
2423import Language.PureScript.Docs.Types
2524import Language.PureScript.Docs.Convert (collectBookmarks)
2625
27−data ParseDesugarError
28− = ParseError P.MultipleErrors
29− | SortModulesError P.MultipleErrors
30− | DesugarError P.MultipleErrors
31− deriving (Show)
32−
3326-- |
3427-- Given:
3528--
@@ -50,7 +43,7 @@ parseAndDesugar ::
5043 [FilePath]
5144 -> [(PackageName, FilePath)]
5245 -> ([Bookmark] -> [P.Module] -> IO a)
53− -> IO (Either ParseDesugarError a)
46+ -> IO (Either P.MultipleErrors a)
5447parseAndDesugar inputFiles depsFiles callback = do
5548 inputFiles' <- traverse (parseAs Local) inputFiles
5649 depsFiles' <- traverse (\(pkgName, f) -> parseAs (FromDep pkgName) f) depsFiles
@@ -63,15 +56,15 @@ parseAndDesugar inputFiles depsFiles callback = do
6356
6457parseFiles ::
6558 [(FileInfo, FilePath)]
66− -> ExceptT ParseDesugarError IO [(FileInfo, P.Module)]
59+ -> ExceptT P.MultipleErrors IO [(FileInfo, P.Module)]
6760parseFiles =
68− throwLeft ParseError . P.parseModulesFromFiles fileInfoToString
61+ throwLeft . P.parseModulesFromFiles fileInfoToString
6962
7063sortModules ::
7164 [P.Module]
72− -> ExceptT ParseDesugarError IO [P.Module]
65+ -> ExceptT P.MultipleErrors IO [P.Module]
7366sortModules =
74− fmap fst . throwLeft SortModulesError . sortModules' . map importPrim
67+ fmap fst . throwLeft . sortModules' . map importPrim
7568 where
7669 sortModules' :: [P.Module] -> Either P.MultipleErrors ([P.Module], P.ModuleGraph)
7770 sortModules' = P.sortModules
@@ -79,9 +72,9 @@ sortModules =
7972desugarWithBookmarks ::
8073 [(FileInfo, P.Module)]
8174 -> [P.Module]
82− -> ExceptT ParseDesugarError IO ([Bookmark], [P.Module])
75+ -> ExceptT P.MultipleErrors IO ([Bookmark], [P.Module])
8376desugarWithBookmarks msInfo msSorted = do
84− msDesugared <- throwLeft DesugarError (desugar msSorted)
77+ msDesugared <- throwLeft (desugar msSorted)
8578
8679 let msDeps = getDepsModuleNames (map (\(fp, m) -> (,m) <$> fp) msInfo)
8780 msPackages = map (addPackage msDeps) msDesugared
@@ -89,8 +82,8 @@ desugarWithBookmarks msInfo msSorted = do
8982
9083 return (bookmarks, takeLocals msPackages)
9184
92−throwLeft :: (MonadError e m) => (l -> e) -> Either l r -> m r
93−throwLeft f = either (throwError . f) return
85+throwLeft :: (MonadError l m) => Either l r -> m r
86+throwLeft = either throwError return
9487
9588-- | Specifies whether a PureScript source file is considered as:
9689--