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
Safe HaskellNone
LanguageHaskell2010

Control.Monad.Trans.Memo.ReaderCache

Description

Generic StateCache - wrapper around ReaderT

Synopsis

Documentation

data ReaderCache c m a Source #

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

Defined in Control.Monad.Trans.Memo.ReaderCache

Methods

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

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

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

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

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

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

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

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

Defined in Control.Monad.Trans.Memo.ReaderCache

Methods

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

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

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

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

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

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

unsafeWrite :: Ix i => IOArray i e -> Int -> e -> ReaderCache 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.Unsafe

Methods

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

(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

Methods

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

(Monad m, Ix k, MaybeLike e v, MArray c e m) => MonadMemo k v (Cache c k e m) Source # 
Instance details

Defined in Control.Monad.Memo.Array

Methods

memo :: (k -> Cache c k e m v) -> k -> Cache c k e 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.Unsafe

Methods

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

add :: Int -> v -> Cache c s e m () 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

Methods

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

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

(Monad m, Ix k, MaybeLike e v, MArray c e m) => MonadCache k v (Cache c k e m) Source # 
Instance details

Defined in Control.Monad.Memo.Array

Methods

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

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

MonadTrans (ReaderCache c) Source # 
Instance details

Defined in Control.Monad.Trans.Memo.ReaderCache

Methods

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

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

Defined in Control.Monad.Trans.Memo.ReaderCache

Methods

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

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

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

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

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

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

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

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

Defined in Control.Monad.Trans.Memo.ReaderCache

Methods

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

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

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

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

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

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

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

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

Defined in Control.Monad.Trans.Memo.ReaderCache

Methods

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

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

return :: a -> ReaderCache c m a #

fail :: String -> ReaderCache c m a #

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

Defined in Control.Monad.Trans.Memo.ReaderCache

Methods

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

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

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

Defined in Control.Monad.Trans.Memo.ReaderCache

Methods

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

Applicative m => Applicative (ReaderCache c m) Source # 
Instance details

Defined in Control.Monad.Trans.Memo.ReaderCache

Methods

pure :: a -> ReaderCache c m a #

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

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

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

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

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

Defined in Control.Monad.Trans.Memo.ReaderCache

Methods

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

Alternative m => Alternative (ReaderCache c m) Source # 
Instance details

Defined in Control.Monad.Trans.Memo.ReaderCache

Methods

empty :: ReaderCache c m a #

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

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

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

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

Defined in Control.Monad.Trans.Memo.ReaderCache

Methods

mzero :: ReaderCache c m a #

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

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

Defined in Control.Monad.Trans.Memo.ReaderCache

Associated Types

type PrimState (ReaderCache c m) :: * #

Methods

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

type PrimState (ReaderCache c m) Source # 
Instance details

Defined in Control.Monad.Trans.Memo.ReaderCache

type UArray (ReaderCache c IO) Source # 
Instance details

Defined in Control.Monad.Memo.Array

type UArray (ReaderCache c (ST s)) Source # 
Instance details

Defined in Control.Monad.Memo.Array

type UArray (ReaderCache c (ST s)) = STUArray s
type Array (ReaderCache c IO) Source # 
Instance details

Defined in Control.Monad.Memo.Array

type Array (ReaderCache c (ST s)) Source # 
Instance details

Defined in Control.Monad.Memo.Array

type Array (ReaderCache c (ST s)) = STArray s

evalReaderCache :: ReaderCache r m a -> r -> m a Source #

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

Returns internal container