monad-memo-0.4.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 HaskellSafe
LanguageHaskell98

Control.Monad.Trans.Memo.StateCache

Description

Generic StateCache - similar to StateT but optimised for carrying cache container

Synopsis

Documentation

newtype StateCache c m a #

Generic memoization cache which uses provided container which can also be updated by the computation. This is pretty much identical to StateT, but is tuned to speed up implementations which use unboxed mutable containers

Constructors

StateCache 

Fields

Instances
(PrimMonad m, PrimState m ~ s, MaybeLike e v, MVector c e) => MonadMemo Int v (Cache c s e m) # 
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 #

(Monad m, MapLike c k v) => MonadMemo k v (MemoStateT c k v m) # 
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 #

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

Defined in Control.Monad.Memo.Vector.Expandable

Methods

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

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

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

Defined in Control.Monad.Trans.Memo.State

Methods

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

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

MonadTrans (StateCache c) # 
Instance details

Defined in Control.Monad.Trans.Memo.StateCache

Methods

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

Monad m => Monad (StateCache c m) # 
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) # 
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) # 
Instance details

Defined in Control.Monad.Trans.Memo.StateCache

Methods

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

(Functor m, Monad m) => Applicative (StateCache c m) # 
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) # 
Instance details

Defined in Control.Monad.Trans.Memo.StateCache

Methods

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

(Functor m, MonadPlus m) => Alternative (StateCache c m) # 
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) # 
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 #

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

Returns internal container

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

Assigns new value to internal container

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

Evaluates computation discarding the resulting container