stateful-mtl-1.0.1: Stateful monad transformers with pure evaluation semantics.

Control.Monad.Array.MArray

Description

Provides a MonadArray implementation for any MArray. Examples of when this would be useful include unboxed arrays and array implementations for specialized monads like STM.

Synopsis

Documentation

data MArrayM a e m x Source

Provides a monadic wrapper around any MArray implementation.

Instances

MonadST s m => MonadST s (MArrayM a e m) 
(Monad m, MArray a e m) => MonadArray e (MArrayM a e m) 
Monad m => Monad (MArrayM a e m) 
MonadFix m => MonadFix (MArrayM a e m) 
MonadPlus m => MonadPlus (MArrayM a e m) 
MonadIO m => MonadIO (MArrayM a e m) 

liftMArray :: (Monad m, MArray a e m) => m x -> MArrayM a e m xSource

Lifts a computation in the underlying monad to an MArrayM computation on an array in the same monad.

evalMArrayM :: (Monad m, MArray a e m) => Int -> e -> MArrayM a e m x -> m xSource

Executes an MArrayM computation with the specified initial size and default element.

execMArrayM :: (Monad m, MArray a e m) => Int -> e -> MArrayM a e m x -> m (a Int e)Source

Executes an MArrayM computation with the specified initial size and default element, returning the final array.

evalMArrayM_ :: (Monad m, MArray a e m) => Int -> MArrayM a e m x -> m xSource

Executes an MArrayM computation with the specified initial size and no default element.

execMArrayM_ :: (Monad m, MArray a e m) => Int -> MArrayM a e m x -> m (a Int e)Source

Executes an MArrayM computation with the specified initial size and no default element, returning the final array.