monad-par-0.3.5: A library for parallel programming based on a monad

Safe Haskell | None
Language | Haskell98

Control.Monad.Par.IO

Description

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.

Synopsis

- data ParIO a
- data IVar a
- runParIO :: ParIO a -> IO a

# Documentation

data ParIO a Source #

A wrapper around an underlying Par type which allows IO.

#### Instances

Instances details

Monad ParIO Source # |
Instance details Defined in Control.Monad.Par.IO Methods (>>=) :: ParIO a -> (a -> ParIO b) -> ParIO b (>>) :: ParIO a -> ParIO b -> ParIO b return :: a -> ParIO a
Functor ParIO Source # |
Instance details Defined in Control.Monad.Par.IO Methods fmap :: (a -> b) -> ParIO a -> ParIO b (<$) :: a -> ParIO b -> ParIO a
MonadFix ParIO Source # |
Instance details Defined in Control.Monad.Par.IO Methods mfix :: (a -> ParIO a) -> ParIO a
Applicative ParIO Source # |
Instance details Defined in Control.Monad.Par.IO Methods pure :: a -> ParIO a (<*>) :: ParIO (a -> b) -> ParIO a -> ParIO b liftA2 :: (a -> b -> c) -> ParIO a -> ParIO b -> ParIO c (*>) :: ParIO a -> ParIO b -> ParIO b (<*) :: ParIO a -> ParIO b -> ParIO a
MonadIO ParIO Source # |
Instance details Defined in Control.Monad.Par.IO Methods liftIO :: IO a -> ParIO a
ParFuture IVar ParIO Source # |
Instance details Defined in Control.Monad.Par.IO Methods spawn :: NFData a => ParIO a -> ParIO (IVar a) Source # spawn_ :: ParIO a -> ParIO (IVar a) Source # get :: IVar a -> ParIO a Source # spawnP :: NFData a => a -> ParIO (IVar a) Source #
ParIVar IVar ParIO Source # |
Instance details Defined in Control.Monad.Par.IO Methods fork :: ParIO () -> ParIO () Source # new :: ParIO (IVar a) Source # put :: NFData a => IVar a -> a -> ParIO () Source # put_ :: IVar a -> a -> ParIO () Source # newFull :: NFData a => a -> ParIO (IVar a) Source # newFull_ :: a -> ParIO (IVar a) Source #

data IVar a Source #

#### Instances

Instances details

ParFuture IVar Par Source # |
Instance details Defined in Control.Monad.Par.Scheds.Trace Methods spawn :: NFData a => Par a -> Par (IVar a) Source # spawn_ :: Par a -> Par (IVar a) Source # get :: IVar a -> Par a Source # spawnP :: NFData a => a -> Par (IVar a) Source #
ParFuture IVar ParIO Source # |
Instance details Defined in Control.Monad.Par.IO Methods spawn :: NFData a => ParIO a -> ParIO (IVar a) Source # spawn_ :: ParIO a -> ParIO (IVar a) Source # get :: IVar a -> ParIO a Source # spawnP :: NFData a => a -> ParIO (IVar a) Source #
ParIVar IVar Par Source # |
Instance details Defined in Control.Monad.Par.Scheds.Trace Methods fork :: Par () -> Par () Source # new :: Par (IVar a) Source # put :: NFData a => IVar a -> a -> Par () Source # put_ :: IVar a -> a -> Par () Source # newFull :: NFData a => a -> Par (IVar a) Source # newFull_ :: a -> Par (IVar a) Source #
ParIVar IVar ParIO Source # |
Instance details Defined in Control.Monad.Par.IO Methods fork :: ParIO () -> ParIO () Source # new :: ParIO (IVar a) Source # put :: NFData a => IVar a -> a -> ParIO () Source # put_ :: IVar a -> a -> ParIO () Source # newFull :: NFData a => a -> ParIO (IVar a) Source # newFull_ :: a -> ParIO (IVar a) Source #
Eq (IVar a) Source # | Equality for IVars is physical equality, as with other reference types.
Instance details Defined in Control.Monad.Par.Scheds.TraceInternal Methods (==) :: IVar a -> IVar a -> Bool (/=) :: IVar a -> IVar a -> Bool
NFData (IVar a) Source # |
Instance details Defined in Control.Monad.Par.Scheds.TraceInternal Methods rnf :: IVar a -> ()

runParIO :: ParIO a -> IO a Source #

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 parallel IO computations are present, including nondeterminsm.

A simple example program:

     runParIO (liftIO $ putStrLn "hi" :: ParIO ())