monad-fork-0.1: Type class for monads which support a fork operation.

Safe HaskellNone




class MonadFork m whereSource

The MonadFork type class, for monads which support a fork operation.

The instance for IO is simply forkIO, while several very overlapping instances are provided for composite monads, using the monad-control package.

An example of a monad which has a MonadFork instance that is not simply a lifted form of forkIO is the ResourceT monad from the conduit package, which defines the operation resourceForkIO. The instances defined here, using the OverlappingInstances extension, will correctly handle the case of monads transformed on top of ResourceT (assuming a definition exists for ResourceT).


fork :: m () -> m ThreadIdSource