monad-par-0.3.4.8: 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

Monad ParIO Source # |
Methods (>>=) :: ParIO a -> (a -> ParIO b) -> ParIO b # (>>) :: ParIO a -> ParIO b -> ParIO b # return :: a -> ParIO a # fail :: String -> ParIO a #
Functor ParIO Source # |
Methods fmap :: (a -> b) -> ParIO a -> ParIO b # (<$) :: a -> ParIO b -> ParIO a #
Applicative ParIO Source # |
Methods pure :: a -> ParIO a # (<*>) :: ParIO (a -> b) -> ParIO a -> ParIO b # (*>) :: ParIO a -> ParIO b -> ParIO b # (<*) :: ParIO a -> ParIO b -> ParIO a #
MonadIO ParIO Source # |
Methods liftIO :: IO a -> ParIO a #
ParFuture IVar ParIO Source # |
Methods spawn :: NFData a => ParIO a -> ParIO (IVar a) # spawn_ :: ParIO a -> ParIO (IVar a) # get :: IVar a -> ParIO a # spawnP :: NFData a => a -> ParIO (IVar a) #
ParIVar IVar ParIO Source # |
Methods fork :: ParIO () -> ParIO () # new :: ParIO (IVar a) # put :: NFData a => IVar a -> a -> ParIO () # put_ :: IVar a -> a -> ParIO () # newFull :: NFData a => a -> ParIO (IVar a) # newFull_ :: a -> ParIO (IVar a) #

data IVar a Source #

Instances

ParFuture IVar ParIO # |
Methods spawn :: NFData a => ParIO a -> ParIO (IVar a) # spawn_ :: ParIO a -> ParIO (IVar a) # get :: IVar a -> ParIO a # spawnP :: NFData a => a -> ParIO (IVar a) #
ParIVar IVar ParIO # |
Methods fork :: ParIO () -> ParIO () # new :: ParIO (IVar a) # put :: NFData a => IVar a -> a -> ParIO () # put_ :: IVar a -> a -> ParIO () # newFull :: NFData a => a -> ParIO (IVar a) # newFull_ :: a -> ParIO (IVar a) #
Eq (IVar a) Source # | Equality for IVars is physical equality, as with other reference types.
Methods (==) :: IVar a -> IVar a -> Bool # (/=) :: IVar a -> IVar a -> Bool #
NFData (IVar a) Source # |
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 ())