Skip to content

Commit 6fb43a4

Browse files
committed
read ide files concurrently
1 parent 92fb93e commit 6fb43a4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Language/PureScript/Ide/SourceFile.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ import Language.PureScript.CST qualified as CST
2929
import Language.PureScript.Ide.Error (IdeError)
3030
import Language.PureScript.Ide.Types (DefinitionSites, IdeNamespace(..), IdeNamespaced(..), TypeAnnotations)
3131
import Language.PureScript.Ide.Util (ideReadFile)
32+
import Control.Concurrent.Async.Lifted (mapConcurrently)
33+
import Control.Monad.Trans.Control (MonadBaseControl)
3234

3335
parseModule :: FilePath -> Text -> Either FilePath (FilePath, P.Module)
3436
parseModule path file =
@@ -37,11 +39,11 @@ parseModule path file =
3739
Right m -> Right (path, m)
3840

3941
parseModulesFromFiles
40-
:: (MonadIO m, MonadError IdeError m)
42+
:: (MonadIO m, MonadBaseControl IO m, MonadError IdeError m)
4143
=> [FilePath]
4244
-> m [Either FilePath (FilePath, P.Module)]
4345
parseModulesFromFiles paths = do
44-
files <- traverse ideReadFile paths
46+
files <- mapConcurrently ideReadFile paths
4547
pure (inParallel (map (uncurry parseModule) files))
4648
where
4749
inParallel :: [Either e (k, a)] -> [Either e (k, a)]

0 commit comments

Comments
 (0)