packages feed

monad-par 0.3.4.3 → 0.3.4.4

raw patch · 3 files changed

+17/−18 lines, 3 filesPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

API changes (from Hackage documentation)

+ Control.Monad.Par.Scheds.TraceInternal: LiftIO :: (IO a) -> (a -> Trace) -> Trace

Files

Control/Monad/Par/IO.hs view
@@ -1,34 +1,28 @@-{-# LANGUAGE GeneralizedNewtypeDeriving, PackageImports #-}+{-# LANGUAGE GeneralizedNewtypeDeriving #-} {- |    This module is an alternative version of "Control.Monad.Par" in    which the `Par` type provides `IO` operations, by means of `liftIO`.    The price paid is that only `runParIO` is available, not the pure `runPar`. -   This module uses the same default scheduler as "Control.Monad.Par",-   and tasks scheduled by the two can share the same pool of worker-   threads.   +   This module uses the same default scheduler as "Control.Monad.Par".  -}  module Control.Monad.Par.IO-  ( ParIO, P.IVar, runParIO+  ( ParIO, IVar, runParIO     -- And instances!                  )   where --- import qualified Control.Monad.Par as P--- import qualified Control.Monad.Par.Scheds.Trace as P--- import qualified Control.Monad.Par.Scheds.TraceInternal as TI+import Control.Monad.Par.Scheds.Trace (Par, IVar)+import qualified Control.Monad.Par.Scheds.TraceInternal as Internal -import qualified Control.Monad.Par.Scheds.DirectInternal as PI-import qualified Control.Monad.Par.Scheds.Direct as P import Control.Monad.Par.Class import Control.Applicative-import "mtl" Control.Monad.Trans (lift, liftIO, MonadIO)+import Control.Monad.Trans (liftIO, MonadIO)  -- | A wrapper around an underlying Par type which allows IO.-newtype ParIO a = ParIO { unPar :: PI.Par a }-  deriving (Functor, Applicative, Monad,-            ParFuture P.IVar, ParIVar P.IVar)+newtype ParIO a = ParIO (Par a)+  deriving (Functor, Applicative, Monad, ParFuture IVar, ParIVar IVar)  -- | A run method which allows actual IO to occur on top of the Par --   monad.  Of course this means that all the normal problems of@@ -36,9 +30,9 @@ -- --   A simple example program: -----   >  runParIO (liftIO$ putStrLn "hi" :: ParIO ())+--   >  runParIO (liftIO $ putStrLn "hi" :: ParIO ()) runParIO :: ParIO a -> IO a-runParIO = P.runParIO . unPar+runParIO (ParIO p) = Internal.runParIO p  instance MonadIO ParIO where-    liftIO io = ParIO (PI.Par (lift$ lift io))+    liftIO io = ParIO (Internal.Par (Internal.LiftIO io))
Control/Monad/Par/Scheds/TraceInternal.hs view
@@ -36,6 +36,7 @@            | Fork Trace Trace            | Done            | Yield Trace+           | forall a . LiftIO (IO a) (a -> Trace)  -- | The main scheduler loop. sched :: Bool -> Sched -> Trace -> IO ()@@ -83,6 +84,9 @@ 	-- This would also be a chance to steal and work from opposite ends of the queue.         atomicModifyIORef workpool $ \ts -> (ts++[parent], ()) 	reschedule queue+    LiftIO io c -> do+        r <- io+        loop (c r)  -- | Process the next item on the work queue or, failing that, go into --   work-stealing mode.
monad-par.cabal view
@@ -1,5 +1,5 @@ Name:                monad-par-Version:             0.3.4.3+Version:             0.3.4.4 Synopsis:            A library for parallel programming based on a monad  @@ -21,6 +21,7 @@ --  0.3.4.1  : fix build with GHC 7.0, and fix test --  0.3.4.2  : Bugfix, 0.3.4.1 was released with debugging switches flipped. --  0.3.4.3  : Bugfix, Trace scheduler is now the default+--  0.3.4.4  : Use the Trace scheduler in Control.Monad.Par.IO too  Description:   The 'Par' monad offers a simple API for parallel programming.  The