monad-memo-0.5.4: Memoization monad transformer

Copyright | (c) Eduard Sergeev 2013
License | BSD-style (see the file LICENSE)
Maintainer | eduard.sergeev@gmail.com
Stability | experimental
Portability | non-portable
Safe Haskell | None
Language | Haskell2010

Control.Monad.Trans.Memo.ReaderCache

Description

Generic StateCache - wrapper around `ReaderT`

Synopsis

- data ReaderCache c (m :: Type -> Type) a
- evalReaderCache :: ReaderCache r m a -> r -> m a
- container :: forall (m :: Type -> Type) c. Monad m => ReaderCache c m c

# Documentation

data ReaderCache c (m :: Type -> Type) a Source #

#### Instances

Instances details

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) Source #

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

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

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

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

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

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

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) Source #

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

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

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

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

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

unsafeWrite :: Ix i => IOArray i e -> Int -> e -> ReaderCache c IO () 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 #
(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 #
(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 #
(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 #
(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 #
(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 #
MonadTrans (ReaderCache c) Source # |
Instance details Defined in Control.Monad.Trans.Memo.ReaderCache Methods lift :: Monad m => m a -> ReaderCache c m a Source #
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) Source #

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

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

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

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

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

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

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) Source #

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

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

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

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

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

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

MonadIO m => MonadIO (ReaderCache c m) Source # |
Instance details Defined in Control.Monad.Trans.Memo.ReaderCache Methods liftIO :: IO a -> ReaderCache c m a Source #
Alternative m => Alternative (ReaderCache c m) Source # |
Instance details Defined in Control.Monad.Trans.Memo.ReaderCache Methods empty :: ReaderCache c m a Source # (<|>) :: ReaderCache c m a -> ReaderCache c m a -> ReaderCache c m a Source # some :: ReaderCache c m a -> ReaderCache c m [a] Source # many :: ReaderCache c m a -> ReaderCache c m [a] Source #
Applicative m => Applicative (ReaderCache c m) Source # |

Instance details

Defined in Control.Monad.Trans.Memo.ReaderCache

Methods

pure :: a -> ReaderCache c m a Source #

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

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

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

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

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 Source # (<$) :: a -> ReaderCache c m b -> ReaderCache c m a Source #
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 Source # (>>) :: ReaderCache c m a -> ReaderCache c m b -> ReaderCache c m b Source # return :: a -> ReaderCache c m a Source #
MonadPlus m => MonadPlus (ReaderCache c m) Source # |
Instance details Defined in Control.Monad.Trans.Memo.ReaderCache Methods mzero :: ReaderCache c m a Source # mplus :: ReaderCache c m a -> ReaderCache c m a -> ReaderCache c m a Source #
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 Source #
PrimMonad m => PrimMonad (ReaderCache c m) Source # |

Instance details

Defined in Control.Monad.Trans.Memo.ReaderCache

Associated Types

type PrimState (ReaderCache c m) |
Instance details Defined in Control.Monad.Trans.Memo.ReaderCache type PrimState (ReaderCache c m) = PrimState m

Methods

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

type Array (ReaderCache c (ST s)) Source # |
Instance details Defined in Control.Monad.Memo.Array type Array (ReaderCache c (ST s)) = STArray s
type Array (ReaderCache c IO) Source # |
Instance details Defined in Control.Monad.Memo.Array type Array (ReaderCache c IO) = IOArray
type UArray (ReaderCache c (ST s)) Source # |
Instance details Defined in Control.Monad.Memo.Array type UArray (ReaderCache c (ST s)) = STUArray s
type UArray (ReaderCache c IO) Source # |
Instance details Defined in Control.Monad.Memo.Array type UArray (ReaderCache c IO) = IOUArray
type PrimState (ReaderCache c m) Source # |
Instance details Defined in Control.Monad.Trans.Memo.ReaderCache type PrimState (ReaderCache c m) = PrimState m

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

container :: forall (m :: Type -> Type) c. Monad m => ReaderCache c m c Source #

Returns internal container