monad-memo-0.5.1: Memoization monad transformer

Copyright(c) Eduard Sergeev 2013
LicenseBSD-style (see the file LICENSE)
Maintainereduard.sergeev@gmail.com
Stabilityexperimental
Portabilitynon-portable (multi-param classes, flexible instances)
Safe HaskellNone
LanguageHaskell2010

Control.Monad.Trans.Memo.StateCache

Description

Generic StateCache - wrapper around StateT

Synopsis

Documentation

data StateCache c m a Source #

Instances
MArray IOUArray e IO => MArray IOUArray e (StateCache c IO) Source # 
Instance details

Defined in Control.Monad.Trans.Memo.StateCache

Methods

getBounds :: Ix i => IOUArray i e -> StateCache c IO (i, i) #

getNumElements :: Ix i => IOUArray i e -> StateCache c IO Int

newArray :: Ix i => (i, i) -> e -> StateCache c IO (IOUArray i e) #

newArray_ :: Ix i => (i, i) -> StateCache c IO (IOUArray i e) #

unsafeNewArray_ :: Ix i => (i, i) -> StateCache c IO (IOUArray i e)

unsafeRead :: Ix i => IOUArray i e -> Int -> StateCache c IO e

unsafeWrite :: Ix i => IOUArray i e -> Int -> e -> StateCache c IO ()

MArray IOArray e (StateCache c IO) Source # 
Instance details

Defined in Control.Monad.Trans.Memo.StateCache

Methods

getBounds :: Ix i => IOArray i e -> StateCache c IO (i, i) #

getNumElements :: Ix i => IOArray i e -> StateCache c IO Int

newArray :: Ix i => (i, i) -> e -> StateCache c IO (IOArray i e) #

newArray_ :: Ix i => (i, i) -> StateCache c IO (IOArray i e) #

unsafeNewArray_ :: Ix i => (i, i) -> StateCache c IO (IOArray i e)

unsafeRead :: Ix i => IOArray i e -> Int -> StateCache c IO e

unsafeWrite :: Ix i => IOArray i e -> Int -> e -> StateCache c IO ()

(PrimMonad m, PrimState m ~ s, MaybeLike e v, MVector c e) => MonadMemo Int v (Cache c s e m) Source # 
Instance details

Defined in Control.Monad.Memo.Vector.Expandable

Methods

memo :: (Int -> Cache c s e m v) -> Int -> Cache c s e m v Source #

(Monad m, MapLike c k v) => MonadMemo k v (MemoStateT c k v m) Source # 
Instance details

Defined in Control.Monad.Trans.Memo.State

Methods

memo :: (k -> MemoStateT c k v m v) -> k -> MemoStateT c k v m v Source #

(PrimMonad m, PrimState m ~ s, MaybeLike e v, MVector c e) => MonadCache Int v (Cache c s e m) Source # 
Instance details

Defined in Control.Monad.Memo.Vector.Expandable

Methods

lookup :: Int -> Cache c s e m (Maybe v) Source #

add :: Int -> v -> Cache c s e m () Source #

(Monad m, MapLike c k v) => MonadCache k v (MemoStateT c k v m) Source # 
Instance details

Defined in Control.Monad.Trans.Memo.State

Methods

lookup :: k -> MemoStateT c k v m (Maybe v) Source #

add :: k -> v -> MemoStateT c k v m () Source #

MonadTrans (StateCache c) Source # 
Instance details

Defined in Control.Monad.Trans.Memo.StateCache

Methods

lift :: Monad m => m a -> StateCache c m a #

MArray (STUArray s) e (ST s) => MArray (STUArray s) e (StateCache c (ST s)) Source # 
Instance details

Defined in Control.Monad.Trans.Memo.StateCache

Methods

getBounds :: Ix i => STUArray s i e -> StateCache c (ST s) (i, i) #

getNumElements :: Ix i => STUArray s i e -> StateCache c (ST s) Int

newArray :: Ix i => (i, i) -> e -> StateCache c (ST s) (STUArray s i e) #

newArray_ :: Ix i => (i, i) -> StateCache c (ST s) (STUArray s i e) #

unsafeNewArray_ :: Ix i => (i, i) -> StateCache c (ST s) (STUArray s i e)

unsafeRead :: Ix i => STUArray s i e -> Int -> StateCache c (ST s) e

unsafeWrite :: Ix i => STUArray s i e -> Int -> e -> StateCache c (ST s) ()

MArray (STArray s) e (StateCache c (ST s)) Source # 
Instance details

Defined in Control.Monad.Trans.Memo.StateCache

Methods

getBounds :: Ix i => STArray s i e -> StateCache c (ST s) (i, i) #

getNumElements :: Ix i => STArray s i e -> StateCache c (ST s) Int

newArray :: Ix i => (i, i) -> e -> StateCache c (ST s) (STArray s i e) #

newArray_ :: Ix i => (i, i) -> StateCache c (ST s) (STArray s i e) #

unsafeNewArray_ :: Ix i => (i, i) -> StateCache c (ST s) (STArray s i e)

unsafeRead :: Ix i => STArray s i e -> Int -> StateCache c (ST s) e

unsafeWrite :: Ix i => STArray s i e -> Int -> e -> StateCache c (ST s) ()

Monad m => Monad (StateCache c m) Source # 
Instance details

Defined in Control.Monad.Trans.Memo.StateCache

Methods

(>>=) :: StateCache c m a -> (a -> StateCache c m b) -> StateCache c m b #

(>>) :: StateCache c m a -> StateCache c m b -> StateCache c m b #

return :: a -> StateCache c m a #

fail :: String -> StateCache c m a #

Functor m => Functor (StateCache c m) Source # 
Instance details

Defined in Control.Monad.Trans.Memo.StateCache

Methods

fmap :: (a -> b) -> StateCache c m a -> StateCache c m b #

(<$) :: a -> StateCache c m b -> StateCache c m a #

MonadFix m => MonadFix (StateCache c m) Source # 
Instance details

Defined in Control.Monad.Trans.Memo.StateCache

Methods

mfix :: (a -> StateCache c m a) -> StateCache c m a #

Monad m => Applicative (StateCache c m) Source # 
Instance details

Defined in Control.Monad.Trans.Memo.StateCache

Methods

pure :: a -> StateCache c m a #

(<*>) :: StateCache c m (a -> b) -> StateCache c m a -> StateCache c m b #

liftA2 :: (a -> b -> c0) -> StateCache c m a -> StateCache c m b -> StateCache c m c0 #

(*>) :: StateCache c m a -> StateCache c m b -> StateCache c m b #

(<*) :: StateCache c m a -> StateCache c m b -> StateCache c m a #

MonadIO m => MonadIO (StateCache c m) Source # 
Instance details

Defined in Control.Monad.Trans.Memo.StateCache

Methods

liftIO :: IO a -> StateCache c m a #

MonadPlus m => Alternative (StateCache c m) Source # 
Instance details

Defined in Control.Monad.Trans.Memo.StateCache

Methods

empty :: StateCache c m a #

(<|>) :: StateCache c m a -> StateCache c m a -> StateCache c m a #

some :: StateCache c m a -> StateCache c m [a] #

many :: StateCache c m a -> StateCache c m [a] #

MonadPlus m => MonadPlus (StateCache c m) Source # 
Instance details

Defined in Control.Monad.Trans.Memo.StateCache

Methods

mzero :: StateCache c m a #

mplus :: StateCache c m a -> StateCache c m a -> StateCache c m a #

PrimMonad m => PrimMonad (StateCache c m) Source # 
Instance details

Defined in Control.Monad.Trans.Memo.StateCache

Associated Types

type PrimState (StateCache c m) :: * #

Methods

primitive :: (State# (PrimState (StateCache c m)) -> (#State# (PrimState (StateCache c m)), a#)) -> StateCache c m a #

type PrimState (StateCache c m) Source # 
Instance details

Defined in Control.Monad.Trans.Memo.StateCache

runStateCache :: StateCache s m a -> s -> m (a, s) Source #

container :: Monad m => StateCache c m c Source #

Returns internal container

setContainer :: Monad m => c -> StateCache c m () Source #

Assigns new value to internal container

evalStateCache :: Monad m => StateCache c m a -> c -> m a Source #

Evaluates computation discarding the resulting container