1
1
mirror of https://github.com/github/semantic.git synced 2025-01-06 06:46:07 +03:00

Evaluate the results of tasks to whnf in parallel.

This commit is contained in:
Rob Rix 2017-05-30 14:57:14 -04:00
parent 3a4bf7ebcf
commit e5558c32a4

View File

@ -13,6 +13,7 @@ module Semantic.Task
, runTask
) where
import Control.Parallel.Strategies
import qualified Control.Concurrent.Async as Async
import Control.Monad.Free.Freer
import Data.Functor.Both as Both
@ -83,4 +84,4 @@ runTask = iterFreerA $ \ task yield -> case task of
Decorate algebra term -> yield (decoratorWithAlgebra algebra term)
Diff differ terms -> yield (differ terms)
Render renderer input -> yield (renderer input)
Distribute tasks -> Async.mapConcurrently runTask tasks >>= yield
Distribute tasks -> Async.mapConcurrently runTask tasks >>= yield . withStrategy (parTraversable rseq)