creditmonad-1.0.0: Reasoning about amortized time complexity
Safe HaskellNone
LanguageGHC2021

Control.Monad.Credit

Synopsis

Computations with credits

class Monad m => MonadCount (m :: Type -> Type) where Source #

Methods

tick :: m () Source #

tick consumes one credit of the current cell

Instances

Instances details
Monad m => MonadCount (CounterT s m) Source # 
Instance details

Defined in Control.Monad.Credit.CounterM

Methods

tick :: CounterT s m () Source #

Monad m => MonadCount (CreditT s m) Source # 
Instance details

Defined in Control.Monad.Credit.CreditM

Methods

tick :: CreditT s m () Source #

class Monad m => MonadLazy (m :: Type -> Type) where Source #

Associated Types

data Thunk (m :: Type -> Type) :: (Type -> Type) -> Type -> Type Source #

Methods

delay :: t a -> m (Thunk m t a) Source #

delay creates a new cell with the given thunk

force :: forall (t :: Type -> Type) a. HasStep t m => Thunk m t a -> m a Source #

force retrieves and evaluates the thunk of a cell

lazymatch :: Thunk m t a -> (a -> m b) -> (t a -> m b) -> m b Source #

lazymatch can inspect the unevaluated thunk and allows us to perform an action like forcing or assigning credits.

Instances

Instances details
Monad m => MonadLazy (CounterT s m) Source # 
Instance details

Defined in Control.Monad.Credit.CounterM

Associated Types

data Thunk (CounterT s m) t b 
Instance details

Defined in Control.Monad.Credit.CounterM

data Thunk (CounterT s m) t b = Thunk !(STRef s (Either (t b) b))

Methods

delay :: t a -> CounterT s m (Thunk (CounterT s m) t a) Source #

force :: forall (t :: Type -> Type) a. HasStep t (CounterT s m) => Thunk (CounterT s m) t a -> CounterT s m a Source #

lazymatch :: Thunk (CounterT s m) t a -> (a -> CounterT s m b) -> (t a -> CounterT s m b) -> CounterT s m b Source #

Monad m => MonadLazy (CreditT s m) Source # 
Instance details

Defined in Control.Monad.Credit.CreditM

Associated Types

data Thunk (CreditT s m) t b 
Instance details

Defined in Control.Monad.Credit.CreditM

data Thunk (CreditT s m) t b = Thunk !Cell !(STRef s (Either (t b) b))

Methods

delay :: t a -> CreditT s m (Thunk (CreditT s m) t a) Source #

force :: forall (t :: Type -> Type) a. HasStep t (CreditT s m) => Thunk (CreditT s m) t a -> CreditT s m a Source #

lazymatch :: Thunk (CreditT s m) t a -> (a -> CreditT s m b) -> (t a -> CreditT s m b) -> CreditT s m b Source #

class HasStep (t :: k -> Type) (m :: k -> Type) where Source #

Thunks can take a step to yield a computation that evaluates to their result.

Methods

step :: forall (a :: k). t a -> m a Source #

Instances

Instances details
MonadInherit m => HasStep (CLazyCon m :: Type -> Type) (m :: Type -> Type) Source # 
Instance details

Defined in Test.Credit.Deque.Catenable

Methods

step :: CLazyCon m a -> m a Source #

MonadCredit m => HasStep (ILazyCon m :: Type -> Type) (m :: Type -> Type) Source # 
Instance details

Defined in Test.Credit.Deque.ImplicitCat

Methods

step :: ILazyCon m a -> m a Source #

MonadInherit m => HasStep (SLazyCon m :: Type -> Type) (m :: Type -> Type) Source # 
Instance details

Defined in Test.Credit.Deque.Streams

Methods

step :: SLazyCon m a -> m a Source #

MonadCredit m => HasStep (FLazyCon m :: Type -> Type) (m :: Type -> Type) Source # 
Instance details

Defined in Test.Credit.Finger

Methods

step :: FLazyCon m a -> m a Source #

MonadCredit m => HasStep (PLazyCon m :: Type -> Type) (m :: Type -> Type) Source # 
Instance details

Defined in Test.Credit.Heap.LazyPairing

Methods

step :: PLazyCon m a -> m a Source #

MonadCredit m => HasStep (ILazyCon m :: Type -> Type) (m :: Type -> Type) Source # 
Instance details

Defined in Test.Credit.Queue.Implicit

Methods

step :: ILazyCon m a -> m a Source #

MonadCredit m => HasStep (PLazyCon m :: Type -> Type) (m :: Type -> Type) Source # 
Instance details

Defined in Test.Credit.Queue.Physicists

Methods

step :: PLazyCon m a -> m a Source #

MonadInherit m => HasStep (SLazyCon m :: Type -> Type) (m :: Type -> Type) Source # 
Instance details

Defined in Test.Credit.Queue.Streams

Methods

step :: SLazyCon m a -> m a Source #

MonadCredit m => HasStep (MLazyCon m :: Type -> Type) (m :: Type -> Type) Source # 
Instance details

Defined in Test.Credit.Sortable.MergeSort

Methods

step :: MLazyCon m a -> m a Source #

MonadCredit m => HasStep (BLazyCon m :: Type -> Type) (m :: Type -> Type) Source # 
Instance details

Defined in Test.Credit.Queue.Bootstrapped

Methods

step :: BLazyCon m a -> m a Source #

HasStep (Lazy m :: k -> Type) (m :: k -> Type) Source # 
Instance details

Defined in Control.Monad.Credit.Base

Methods

step :: forall (a :: k). Lazy m a -> m a Source #

newtype Lazy (m :: k -> Type) (a :: k) Source #

A basic thunk that contains the computation to be evaluated. This type can be used to express any thunk but its disadvantage is that it will be printed merely as "lazy".

Constructors

Lazy (m a) 

Instances

Instances details
HasStep (Lazy m :: k -> Type) (m :: k -> Type) Source # 
Instance details

Defined in Control.Monad.Credit.Base

Methods

step :: forall (a :: k). Lazy m a -> m a Source #

Monad m => MemoryCell m (Lazy m a) Source # 
Instance details

Defined in Control.Monad.Credit.Base

Methods

prettyCell :: Lazy m a -> m Memory Source #

data Ticks Source #

Instances

Instances details
Enum Ticks Source # 
Instance details

Defined in Control.Monad.Credit.Base

Num Ticks Source # 
Instance details

Defined in Control.Monad.Credit.Base

Integral Ticks Source # 
Instance details

Defined in Control.Monad.Credit.Base

Real Ticks Source # 
Instance details

Defined in Control.Monad.Credit.Base

Methods

toRational :: Ticks -> Rational #

Show Ticks Source # 
Instance details

Defined in Control.Monad.Credit.Base

Methods

showsPrec :: Int -> Ticks -> ShowS #

show :: Ticks -> String #

showList :: [Ticks] -> ShowS #

Eq Ticks Source # 
Instance details

Defined in Control.Monad.Credit.Base

Methods

(==) :: Ticks -> Ticks -> Bool #

(/=) :: Ticks -> Ticks -> Bool #

Ord Ticks Source # 
Instance details

Defined in Control.Monad.Credit.Base

Methods

compare :: Ticks -> Ticks -> Ordering #

(<) :: Ticks -> Ticks -> Bool #

(<=) :: Ticks -> Ticks -> Bool #

(>) :: Ticks -> Ticks -> Bool #

(>=) :: Ticks -> Ticks -> Bool #

max :: Ticks -> Ticks -> Ticks #

min :: Ticks -> Ticks -> Ticks #

Pretty Ticks Source # 
Instance details

Defined in Control.Monad.Credit.Base

Methods

pretty :: Ticks -> Doc ann #

prettyList :: [Ticks] -> Doc ann #

data Credit Source #

Instances

Instances details
Enum Credit Source # 
Instance details

Defined in Control.Monad.Credit.Base

Num Credit Source # 
Instance details

Defined in Control.Monad.Credit.Base

Integral Credit Source # 
Instance details

Defined in Control.Monad.Credit.Base

Real Credit Source # 
Instance details

Defined in Control.Monad.Credit.Base

Show Credit Source # 
Instance details

Defined in Control.Monad.Credit.Base

Eq Credit Source # 
Instance details

Defined in Control.Monad.Credit.Base

Methods

(==) :: Credit -> Credit -> Bool #

(/=) :: Credit -> Credit -> Bool #

Ord Credit Source # 
Instance details

Defined in Control.Monad.Credit.Base

Pretty Credit Source # 
Instance details

Defined in Control.Monad.Credit.Base

Methods

pretty :: Credit -> Doc ann #

prettyList :: [Credit] -> Doc ann #

class (MonadCount m, MonadLazy m, MonadFail m) => MonadCredit (m :: Type -> Type) where Source #

A computation in the credit monad has a given amounts of credits, which it can spend on computation or transfer to other cells.

Methods

creditWith :: forall (t :: Type -> Type) a. Thunk m t a -> Credit -> m () Source #

creditWith transfers a given amount of credits to a cell

hasAtLeast :: forall (t :: Type -> Type) a. Thunk m t a -> Credit -> m () Source #

assert that a cell has at least a given amount of credits

Instances

Instances details
Monad m => MonadCredit (CounterT s m) Source # 
Instance details

Defined in Control.Monad.Credit.CounterM

Methods

creditWith :: forall (t :: Type -> Type) a. Thunk (CounterT s m) t a -> Credit -> CounterT s m () Source #

hasAtLeast :: forall (t :: Type -> Type) a. Thunk (CounterT s m) t a -> Credit -> CounterT s m () Source #

Monad m => MonadCredit (CreditT s m) Source # 
Instance details

Defined in Control.Monad.Credit.CreditM

Methods

creditWith :: forall (t :: Type -> Type) a. Thunk (CreditT s m) t a -> Credit -> CreditT s m () Source #

hasAtLeast :: forall (t :: Type -> Type) a. Thunk (CreditT s m) t a -> Credit -> CreditT s m () Source #

class MonadCredit m => MonadInherit (m :: Type -> Type) where Source #

Methods

creditAllTo :: forall (t :: Type -> Type) a. Thunk m t a -> m () Source #

creditAllTo transfers all credits to a cell and assigns it as heir

Instances

Instances details
Monad m => MonadInherit (CounterT s m) Source # 
Instance details

Defined in Control.Monad.Credit.CounterM

Methods

creditAllTo :: forall (t :: Type -> Type) a. Thunk (CounterT s m) t a -> CounterT s m () Source #

Monad m => MonadInherit (CreditT s m) Source # 
Instance details

Defined in Control.Monad.Credit.CreditM

Methods

creditAllTo :: forall (t :: Type -> Type) a. Thunk (CreditT s m) t a -> CreditT s m () Source #

Counter Monad

type CounterM s = CounterT s Identity Source #

An instance of the counter monad using ST to memoize thunks.

runCounterM :: (forall s. CounterM s a) -> Either String (a, Ticks) Source #

data CounterT s (m :: Type -> Type) a Source #

A monad transformer on the counter monad. Warning! This monad transformer includes the ST monad transformer and should not be used with monads that can contain multiple answers, like the list monad. Safe monads include the monads State, Reader, Writer, Maybe and combinations of their corresponding monad transformers.

Instances

Instances details
Monad m => MonadError String (CounterT s m) Source # 
Instance details

Defined in Control.Monad.Credit.CounterM

Methods

throwError :: String -> CounterT s m a #

catchError :: CounterT s m a -> (String -> CounterT s m a) -> CounterT s m a #

MonadTrans (CounterT s) Source # 
Instance details

Defined in Control.Monad.Credit.CounterM

Methods

lift :: Monad m => m a -> CounterT s m a #

Monad m => MonadFail (CounterT s m) Source # 
Instance details

Defined in Control.Monad.Credit.CounterM

Methods

fail :: String -> CounterT s m a #

Monad m => Applicative (CounterT s m) Source # 
Instance details

Defined in Control.Monad.Credit.CounterM

Methods

pure :: a -> CounterT s m a #

(<*>) :: CounterT s m (a -> b) -> CounterT s m a -> CounterT s m b #

liftA2 :: (a -> b -> c) -> CounterT s m a -> CounterT s m b -> CounterT s m c #

(*>) :: CounterT s m a -> CounterT s m b -> CounterT s m b #

(<*) :: CounterT s m a -> CounterT s m b -> CounterT s m a #

Functor m => Functor (CounterT s m) Source # 
Instance details

Defined in Control.Monad.Credit.CounterM

Methods

fmap :: (a -> b) -> CounterT s m a -> CounterT s m b #

(<$) :: a -> CounterT s m b -> CounterT s m a #

Monad m => Monad (CounterT s m) Source # 
Instance details

Defined in Control.Monad.Credit.CounterM

Methods

(>>=) :: CounterT s m a -> (a -> CounterT s m b) -> CounterT s m b #

(>>) :: CounterT s m a -> CounterT s m b -> CounterT s m b #

return :: a -> CounterT s m a #

Monad m => MonadCount (CounterT s m) Source # 
Instance details

Defined in Control.Monad.Credit.CounterM

Methods

tick :: CounterT s m () Source #

Monad m => MonadCredit (CounterT s m) Source # 
Instance details

Defined in Control.Monad.Credit.CounterM

Methods

creditWith :: forall (t :: Type -> Type) a. Thunk (CounterT s m) t a -> Credit -> CounterT s m () Source #

hasAtLeast :: forall (t :: Type -> Type) a. Thunk (CounterT s m) t a -> Credit -> CounterT s m () Source #

Monad m => MonadInherit (CounterT s m) Source # 
Instance details

Defined in Control.Monad.Credit.CounterM

Methods

creditAllTo :: forall (t :: Type -> Type) a. Thunk (CounterT s m) t a -> CounterT s m () Source #

Monad m => MonadLazy (CounterT s m) Source # 
Instance details

Defined in Control.Monad.Credit.CounterM

Associated Types

data Thunk (CounterT s m) t b 
Instance details

Defined in Control.Monad.Credit.CounterM

data Thunk (CounterT s m) t b = Thunk !(STRef s (Either (t b) b))

Methods

delay :: t a -> CounterT s m (Thunk (CounterT s m) t a) Source #

force :: forall (t :: Type -> Type) a. HasStep t (CounterT s m) => Thunk (CounterT s m) t a -> CounterT s m a Source #

lazymatch :: Thunk (CounterT s m) t a -> (a -> CounterT s m b) -> (t a -> CounterT s m b) -> CounterT s m b Source #

data Thunk (CounterT s m) t b Source # 
Instance details

Defined in Control.Monad.Credit.CounterM

data Thunk (CounterT s m) t b = Thunk !(STRef s (Either (t b) b))

runCounterT :: Monad m => (forall s. CounterT s m a) -> m (Either String (a, Ticks)) Source #

Credit Monad

type CreditM s = CreditT s Identity Source #

An instance of the credit monad using ST to memoize thunks.

runCreditM :: Credit -> (forall s. CreditM s a) -> Either Error a Source #

data CreditT s (m :: Type -> Type) a Source #

A monad transformer on the credit monad. Warning! This monad transformer includes the ST monad transformer and should not be used with monads that can contain multiple answers, like the list monad. Safe monads include the monads State, Reader, Writer, Maybe and combinations of their corresponding monad transformers.

Instances

Instances details
Monad m => MonadError Error (CreditT s m) Source # 
Instance details

Defined in Control.Monad.Credit.CreditM

Methods

throwError :: Error -> CreditT s m a #

catchError :: CreditT s m a -> (Error -> CreditT s m a) -> CreditT s m a #

MonadTrans (CreditT s) Source # 
Instance details

Defined in Control.Monad.Credit.CreditM

Methods

lift :: Monad m => m a -> CreditT s m a #

Monad m => MonadFail (CreditT s m) Source # 
Instance details

Defined in Control.Monad.Credit.CreditM

Methods

fail :: String -> CreditT s m a #

Monad m => Applicative (CreditT s m) Source # 
Instance details

Defined in Control.Monad.Credit.CreditM

Methods

pure :: a -> CreditT s m a #

(<*>) :: CreditT s m (a -> b) -> CreditT s m a -> CreditT s m b #

liftA2 :: (a -> b -> c) -> CreditT s m a -> CreditT s m b -> CreditT s m c #

(*>) :: CreditT s m a -> CreditT s m b -> CreditT s m b #

(<*) :: CreditT s m a -> CreditT s m b -> CreditT s m a #

Functor m => Functor (CreditT s m) Source # 
Instance details

Defined in Control.Monad.Credit.CreditM

Methods

fmap :: (a -> b) -> CreditT s m a -> CreditT s m b #

(<$) :: a -> CreditT s m b -> CreditT s m a #

Monad m => Monad (CreditT s m) Source # 
Instance details

Defined in Control.Monad.Credit.CreditM

Methods

(>>=) :: CreditT s m a -> (a -> CreditT s m b) -> CreditT s m b #

(>>) :: CreditT s m a -> CreditT s m b -> CreditT s m b #

return :: a -> CreditT s m a #

Monad m => MonadCount (CreditT s m) Source # 
Instance details

Defined in Control.Monad.Credit.CreditM

Methods

tick :: CreditT s m () Source #

Monad m => MonadCredit (CreditT s m) Source # 
Instance details

Defined in Control.Monad.Credit.CreditM

Methods

creditWith :: forall (t :: Type -> Type) a. Thunk (CreditT s m) t a -> Credit -> CreditT s m () Source #

hasAtLeast :: forall (t :: Type -> Type) a. Thunk (CreditT s m) t a -> Credit -> CreditT s m () Source #

Monad m => MonadInherit (CreditT s m) Source # 
Instance details

Defined in Control.Monad.Credit.CreditM

Methods

creditAllTo :: forall (t :: Type -> Type) a. Thunk (CreditT s m) t a -> CreditT s m () Source #

Monad m => MonadLazy (CreditT s m) Source # 
Instance details

Defined in Control.Monad.Credit.CreditM

Associated Types

data Thunk (CreditT s m) t b 
Instance details

Defined in Control.Monad.Credit.CreditM

data Thunk (CreditT s m) t b = Thunk !Cell !(STRef s (Either (t b) b))

Methods

delay :: t a -> CreditT s m (Thunk (CreditT s m) t a) Source #

force :: forall (t :: Type -> Type) a. HasStep t (CreditT s m) => Thunk (CreditT s m) t a -> CreditT s m a Source #

lazymatch :: Thunk (CreditT s m) t a -> (a -> CreditT s m b) -> (t a -> CreditT s m b) -> CreditT s m b Source #

Monad m => MonadMemory (CreditT s m) Source # 
Instance details

Defined in Control.Monad.Credit.CreditM

Methods

prettyThunk :: forall a (t :: Type -> Type). (MemoryCell (CreditT s m) a, MemoryCell (CreditT s m) (t a)) => Thunk (CreditT s m) t a -> CreditT s m Memory Source #

data Thunk (CreditT s m) t b Source # 
Instance details

Defined in Control.Monad.Credit.CreditM

data Thunk (CreditT s m) t b = Thunk !Cell !(STRef s (Either (t b) b))

runCreditT :: Monad m => Credit -> (forall s. CreditT s m a) -> m (Either Error a) Source #

data Error Source #

Instances

Instances details
Show Error Source # 
Instance details

Defined in Control.Monad.Credit.CreditM

Methods

showsPrec :: Int -> Error -> ShowS #

show :: Error -> String #

showList :: [Error] -> ShowS #

Eq Error Source # 
Instance details

Defined in Control.Monad.Credit.CreditM

Methods

(==) :: Error -> Error -> Bool #

(/=) :: Error -> Error -> Bool #

Ord Error Source # 
Instance details

Defined in Control.Monad.Credit.CreditM

Methods

compare :: Error -> Error -> Ordering #

(<) :: Error -> Error -> Bool #

(<=) :: Error -> Error -> Bool #

(>) :: Error -> Error -> Bool #

(>=) :: Error -> Error -> Bool #

max :: Error -> Error -> Error #

min :: Error -> Error -> Error #

Pretty Error Source # 
Instance details

Defined in Control.Monad.Credit.CreditM

Methods

pretty :: Error -> Doc ann #

prettyList :: [Error] -> Doc ann #

Monad m => MonadError Error (CreditT s m) Source # 
Instance details

Defined in Control.Monad.Credit.CreditM

Methods

throwError :: Error -> CreditT s m a #

catchError :: CreditT s m a -> (Error -> CreditT s m a) -> CreditT s m a #

Pretty a => Pretty (Either Error a) Source # 
Instance details

Defined in Control.Monad.Credit.CreditM

Methods

pretty :: Either Error a -> Doc ann #

prettyList :: [Either Error a] -> Doc ann #

data Cell Source #

Instances

Instances details
Show Cell Source # 
Instance details

Defined in Control.Monad.Credit.Base

Methods

showsPrec :: Int -> Cell -> ShowS #

show :: Cell -> String #

showList :: [Cell] -> ShowS #

Eq Cell Source # 
Instance details

Defined in Control.Monad.Credit.Base

Methods

(==) :: Cell -> Cell -> Bool #

(/=) :: Cell -> Cell -> Bool #

Ord Cell Source # 
Instance details

Defined in Control.Monad.Credit.Base

Methods

compare :: Cell -> Cell -> Ordering #

(<) :: Cell -> Cell -> Bool #

(<=) :: Cell -> Cell -> Bool #

(>) :: Cell -> Cell -> Bool #

(>=) :: Cell -> Cell -> Bool #

max :: Cell -> Cell -> Cell #

min :: Cell -> Cell -> Cell #

Pretty Cell Source # 
Instance details

Defined in Control.Monad.Credit.Base

Methods

pretty :: Cell -> Doc ann #

prettyList :: [Cell] -> Doc ann #

Pretty-printing memory cells

data Memory Source #

A view of memory that can be pretty-printed.

Instances

Instances details
Pretty Memory Source # 
Instance details

Defined in Control.Monad.Credit.Base

Methods

pretty :: Memory -> Doc ann #

prettyList :: [Memory] -> Doc ann #

mkMCell :: String -> [Memory] -> Memory Source #

Make memory cell with a given tag and a list of children.

mkMList :: [Memory] -> Maybe Memory -> Memory Source #

A special case for nicer printing of list-like datatypes. ''mkMList [m1,...,mn] Nothing'' renders as ''[m1, .., mn]'', while ''mkMList [m1,...,mn] (Just m)'' renders as ''[m1, .., mn] ++ m''.

linearize :: Memory -> Memory Source #

Inline memory cells that are only used once and remove them from the store

class Monad m => MemoryCell (m :: Type -> Type) a where Source #

A class for pretty-printing memory cells.

Methods

prettyCell :: a -> m Memory Source #

Instances

Instances details
Monad m => MemoryCell m Size Source # 
Instance details

Defined in Test.Credit

Methods

prettyCell :: Size -> m Memory Source #

Monad m => MemoryCell m Int Source # 
Instance details

Defined in Control.Monad.Credit.Base

Methods

prettyCell :: Int -> m Memory Source #

(Monad m, Pretty a) => MemoryCell m (PrettyCell a) Source # 
Instance details

Defined in Control.Monad.Credit.Base

MemoryCell m a => MemoryCell m (Digit a) Source # 
Instance details

Defined in Test.Credit.Finger

Methods

prettyCell :: Digit a -> m Memory Source #

MemoryCell m a => MemoryCell m (Elem a) Source # 
Instance details

Defined in Test.Credit.Finger

Methods

prettyCell :: Elem a -> m Memory Source #

MemoryCell m a => MemoryCell m (Tree a) Source # 
Instance details

Defined in Test.Credit.Heap.Binomial

Methods

prettyCell :: Tree a -> m Memory Source #

MemoryCell m a => MemoryCell m (Digit a) Source # 
Instance details

Defined in Test.Credit.Heap.Scheduled

Methods

prettyCell :: Digit a -> m Memory Source #

MemoryCell m a => MemoryCell m (Tree a) Source # 
Instance details

Defined in Test.Credit.Heap.Scheduled

Methods

prettyCell :: Tree a -> m Memory Source #

MemoryCell m a => MemoryCell m (Digit a) Source # 
Instance details

Defined in Test.Credit.Queue.Implicit

Methods

prettyCell :: Digit a -> m Memory Source #

MemoryCell m a => MemoryCell m (Digit a) Source # 
Instance details

Defined in Test.Credit.RandomAccess.Binary

Methods

prettyCell :: Digit a -> m Memory Source #

MemoryCell m a => MemoryCell m (Tree a) Source # 
Instance details

Defined in Test.Credit.RandomAccess.Binary

Methods

prettyCell :: Tree a -> m Memory Source #

MemoryCell m a => MemoryCell m (Digit a) Source # 
Instance details

Defined in Test.Credit.RandomAccess.Zeroless

Methods

prettyCell :: Digit a -> m Memory Source #

MemoryCell m a => MemoryCell m (Tree a) Source # 
Instance details

Defined in Test.Credit.RandomAccess.Zeroless

Methods

prettyCell :: Tree a -> m Memory Source #

MemoryCell m a => MemoryCell m [a] Source # 
Instance details

Defined in Control.Monad.Credit.Base

Methods

prettyCell :: [a] -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (BDeque a m) Source # 
Instance details

Defined in Test.Credit.Deque.Bankers

Methods

prettyCell :: BDeque a m -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (CLazyCon m a) Source # 
Instance details

Defined in Test.Credit.Deque.Catenable

Methods

prettyCell :: CLazyCon m a -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (CatDeque a m) Source # 
Instance details

Defined in Test.Credit.Deque.Catenable

Methods

prettyCell :: CatDeque a m -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (CmpdElem a m) Source # 
Instance details

Defined in Test.Credit.Deque.ImplicitCat

Methods

prettyCell :: CmpdElem a m -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (ILazyCon m a) Source # 
Instance details

Defined in Test.Credit.Deque.ImplicitCat

Methods

prettyCell :: ILazyCon m a -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (ImplicitCat a m) Source # 
Instance details

Defined in Test.Credit.Deque.ImplicitCat

Methods

prettyCell :: ImplicitCat a m -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (RDeque a m) Source # 
Instance details

Defined in Test.Credit.Deque.Realtime

Methods

prettyCell :: RDeque a m -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (SimpleCat a m) Source # 
Instance details

Defined in Test.Credit.Deque.SimpleCat

Methods

prettyCell :: SimpleCat a m -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (SLazyCon m a) Source # 
Instance details

Defined in Test.Credit.Deque.Streams

Methods

prettyCell :: SLazyCon m a -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (Stream m a) Source # 
Instance details

Defined in Test.Credit.Deque.Streams

Methods

prettyCell :: Stream m a -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (FLazyCon m a) Source # 
Instance details

Defined in Test.Credit.Finger

Methods

prettyCell :: FLazyCon m a -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (FingerDeque a m) Source # 
Instance details

Defined in Test.Credit.Finger

Methods

prettyCell :: FingerDeque a m -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (FingerHeap a m) Source # 
Instance details

Defined in Test.Credit.Finger

Methods

prettyCell :: FingerHeap a m -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (FingerRA a m) Source # 
Instance details

Defined in Test.Credit.Finger

Methods

prettyCell :: FingerRA a m -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (FingerSort a m) Source # 
Instance details

Defined in Test.Credit.Finger

Methods

prettyCell :: FingerSort a m -> m Memory Source #

MemoryCell m a => MemoryCell m (Tuple v a) Source # 
Instance details

Defined in Test.Credit.Finger

Methods

prettyCell :: Tuple v a -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (Binomial a m) Source # 
Instance details

Defined in Test.Credit.Heap.Binomial

Methods

prettyCell :: Binomial a m -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (LazyPairing a m) Source # 
Instance details

Defined in Test.Credit.Heap.LazyPairing

Methods

prettyCell :: LazyPairing a m -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (PLazyCon m a) Source # 
Instance details

Defined in Test.Credit.Heap.LazyPairing

Methods

prettyCell :: PLazyCon m a -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (Scheduled a m) Source # 
Instance details

Defined in Test.Credit.Heap.Scheduled

Methods

prettyCell :: Scheduled a m -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (Stream m a) Source # 
Instance details

Defined in Test.Credit.Heap.Scheduled

Methods

prettyCell :: Stream m a -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (BQueue a m) Source # 
Instance details

Defined in Test.Credit.Queue.Bankers

Methods

prettyCell :: BQueue a m -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (Bootstrapped a m) Source # 
Instance details

Defined in Test.Credit.Queue.Bootstrapped

(MonadMemory m, MemoryCell m a) => MemoryCell m (ILazyCon m a) Source # 
Instance details

Defined in Test.Credit.Queue.Implicit

Methods

prettyCell :: ILazyCon m a -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (Implicit a m) Source # 
Instance details

Defined in Test.Credit.Queue.Implicit

Methods

prettyCell :: Implicit a m -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (PLazyCon m a) Source # 
Instance details

Defined in Test.Credit.Queue.Physicists

Methods

prettyCell :: PLazyCon m a -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (Physicists a m) Source # 
Instance details

Defined in Test.Credit.Queue.Physicists

Methods

prettyCell :: Physicists a m -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (RQueue a m) Source # 
Instance details

Defined in Test.Credit.Queue.Realtime

Methods

prettyCell :: RQueue a m -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (SLazyCon m a) Source # 
Instance details

Defined in Test.Credit.Queue.Streams

Methods

prettyCell :: SLazyCon m a -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (Stream m a) Source # 
Instance details

Defined in Test.Credit.Queue.Streams

Methods

prettyCell :: Stream m a -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (BinaryRA a m) Source # 
Instance details

Defined in Test.Credit.RandomAccess.Binary

Methods

prettyCell :: BinaryRA a m -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (Stream m a) Source # 
Instance details

Defined in Test.Credit.RandomAccess.Binary

Methods

prettyCell :: Stream m a -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (Stream m a) Source # 
Instance details

Defined in Test.Credit.RandomAccess.Zeroless

Methods

prettyCell :: Stream m a -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (ZerolessRA a m) Source # 
Instance details

Defined in Test.Credit.RandomAccess.Zeroless

Methods

prettyCell :: ZerolessRA a m -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (MLazyCon m a) Source # 
Instance details

Defined in Test.Credit.Sortable.MergeSort

Methods

prettyCell :: MLazyCon m a -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (MergeSort a m) Source # 
Instance details

Defined in Test.Credit.Sortable.MergeSort

Methods

prettyCell :: MergeSort a m -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (SMergeSort a m) Source # 
Instance details

Defined in Test.Credit.Sortable.Scheduled

Methods

prettyCell :: SMergeSort a m -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (Stream m a) Source # 
Instance details

Defined in Test.Credit.Sortable.Scheduled

Methods

prettyCell :: Stream m a -> m Memory Source #

(MemoryCell m a, MemoryCell m b) => MemoryCell m (a, b) Source # 
Instance details

Defined in Control.Monad.Credit.Base

Methods

prettyCell :: (a, b) -> m Memory Source #

Monad m => MemoryCell m (Lazy m a) Source # 
Instance details

Defined in Control.Monad.Credit.Base

Methods

prettyCell :: Lazy m a -> m Memory Source #

(MonadMemory m, MemoryCell m a, MemoryCell m (t a)) => MemoryCell m (Thunk m t a) Source # 
Instance details

Defined in Control.Monad.Credit.Base

Methods

prettyCell :: Thunk m t a -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (FingerTree v a m) Source # 
Instance details

Defined in Test.Credit.Finger

Methods

prettyCell :: FingerTree v a m -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (Pairing a m) Source # 
Instance details

Defined in Test.Credit.Heap.Pairing

Methods

prettyCell :: Pairing a m -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (PairingHeap a m) Source # 
Instance details

Defined in Test.Credit.Heap.Pairing

Methods

prettyCell :: PairingHeap a m -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (Batched a m) Source # 
Instance details

Defined in Test.Credit.Queue.Batched

Methods

prettyCell :: Batched a m -> m Memory Source #

(MonadMemory m, MemoryCell m a) => MemoryCell m (BLazyCon m a) Source # 
Instance details

Defined in Test.Credit.Queue.Bootstrapped

Methods

prettyCell :: BLazyCon m a -> m Memory Source #

(MemoryCell m a, MemoryCell m b, MemoryCell m c) => MemoryCell m (a, b, c) Source # 
Instance details

Defined in Control.Monad.Credit.Base

Methods

prettyCell :: (a, b, c) -> m Memory Source #

MemoryCell m (q (PrettyCell a) m) => MemoryCell m (BD q a m) Source # 
Instance details

Defined in Test.Credit.Deque.Base

Methods

prettyCell :: BD q a m -> m Memory Source #

MemoryCell m (q (PrettyCell a) m) => MemoryCell m (D q a m) Source # 
Instance details

Defined in Test.Credit.Deque.Base

Methods

prettyCell :: D q a m -> m Memory Source #

MemoryCell m (h (PrettyCell a) m) => MemoryCell m (BH h a m) Source # 
Instance details

Defined in Test.Credit.Heap.Base

Methods

prettyCell :: BH h a m -> m Memory Source #

MemoryCell m (h (PrettyCell a) m) => MemoryCell m (H h a m) Source # 
Instance details

Defined in Test.Credit.Heap.Base

Methods

prettyCell :: H h a m -> m Memory Source #

MemoryCell m (q (PrettyCell a) m) => MemoryCell m (RA q a m) Source # 
Instance details

Defined in Test.Credit.RandomAccess.Base

Methods

prettyCell :: RA q a m -> m Memory Source #

MemoryCell m (q (PrettyCell a) m) => MemoryCell m (S q a m) Source # 
Instance details

Defined in Test.Credit.Sortable.Base

Methods

prettyCell :: S q a m -> m Memory Source #

class Monad m => MonadMemory (m :: Type -> Type) where Source #

Methods

prettyThunk :: forall a (t :: Type -> Type). (MemoryCell m a, MemoryCell m (t a)) => Thunk m t a -> m Memory Source #

Instances

Instances details
Monad m => MonadMemory (CreditT s m) Source # 
Instance details

Defined in Control.Monad.Credit.CreditM

Methods

prettyThunk :: forall a (t :: Type -> Type). (MemoryCell (CreditT s m) a, MemoryCell (CreditT s m) (t a)) => Thunk (CreditT s m) t a -> CreditT s m Memory Source #

newtype PrettyCell a Source #

Constructors

PrettyCell a 

Instances

Instances details
(Monad m, Pretty a) => MemoryCell m (PrettyCell a) Source # 
Instance details

Defined in Control.Monad.Credit.Base

Show a => Show (PrettyCell a) Source # 
Instance details

Defined in Control.Monad.Credit.Base

Pretty a => MemoryStructure (BDeque (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Deque.Bankers

Pretty a => MemoryStructure (CatDeque (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Deque.Catenable

Pretty a => MemoryStructure (ImplicitCat (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Deque.ImplicitCat

Pretty a => MemoryStructure (RDeque (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Deque.Realtime

Pretty a => MemoryStructure (SimpleCat (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Deque.SimpleCat

Pretty a => MemoryStructure (FingerDeque (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Finger

Pretty a => MemoryStructure (FingerHeap (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Finger

Pretty a => MemoryStructure (FingerRA (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Finger

Pretty a => MemoryStructure (FingerSort (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Finger

Pretty a => MemoryStructure (Binomial (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Heap.Binomial

Pretty a => MemoryStructure (LazyPairing (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Heap.LazyPairing

Pretty a => MemoryStructure (Scheduled (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Heap.Scheduled

Pretty a => MemoryStructure (BQueue (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Queue.Bankers

Pretty a => MemoryStructure (Bootstrapped (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Queue.Bootstrapped

Pretty a => MemoryStructure (Implicit (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Queue.Implicit

Pretty a => MemoryStructure (Physicists (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Queue.Physicists

Pretty a => MemoryStructure (RQueue (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Queue.Realtime

Pretty a => MemoryStructure (BinaryRA (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.RandomAccess.Binary

Pretty a => MemoryStructure (ZerolessRA (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.RandomAccess.Zeroless

Pretty a => MemoryStructure (MergeSort (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Sortable.MergeSort

Pretty a => MemoryStructure (SMergeSort (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Sortable.Scheduled

Eq a => Eq (PrettyCell a) Source # 
Instance details

Defined in Control.Monad.Credit.Base

Methods

(==) :: PrettyCell a -> PrettyCell a -> Bool #

(/=) :: PrettyCell a -> PrettyCell a -> Bool #

Ord a => Ord (PrettyCell a) Source # 
Instance details

Defined in Control.Monad.Credit.Base

Pretty a => MemoryStructure (FingerTree v (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Finger

Pretty a => MemoryStructure (Pairing (PrettyCell a) :: (Type -> Type) -> Type) Source # 
Instance details

Defined in Test.Credit.Heap.Pairing

Pretty a => MemoryStructure (Batched (PrettyCell a) :: (Type -> Type) -> Type) Source # 
Instance details

Defined in Test.Credit.Queue.Batched

class MemoryStructure (t :: (Type -> Type) -> Type) where Source #

Methods

prettyStructure :: MonadMemory m => t m -> m Memory Source #

Instances

Instances details
Pretty a => MemoryStructure (BDeque (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Deque.Bankers

Pretty a => MemoryStructure (CatDeque (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Deque.Catenable

Pretty a => MemoryStructure (ImplicitCat (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Deque.ImplicitCat

Pretty a => MemoryStructure (RDeque (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Deque.Realtime

Pretty a => MemoryStructure (SimpleCat (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Deque.SimpleCat

Pretty a => MemoryStructure (FingerDeque (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Finger

Pretty a => MemoryStructure (FingerHeap (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Finger

Pretty a => MemoryStructure (FingerRA (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Finger

Pretty a => MemoryStructure (FingerSort (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Finger

Pretty a => MemoryStructure (Binomial (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Heap.Binomial

Pretty a => MemoryStructure (LazyPairing (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Heap.LazyPairing

Pretty a => MemoryStructure (Scheduled (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Heap.Scheduled

Pretty a => MemoryStructure (BQueue (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Queue.Bankers

Pretty a => MemoryStructure (Bootstrapped (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Queue.Bootstrapped

Pretty a => MemoryStructure (Implicit (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Queue.Implicit

Pretty a => MemoryStructure (Physicists (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Queue.Physicists

Pretty a => MemoryStructure (RQueue (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Queue.Realtime

Pretty a => MemoryStructure (BinaryRA (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.RandomAccess.Binary

Pretty a => MemoryStructure (ZerolessRA (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.RandomAccess.Zeroless

Pretty a => MemoryStructure (MergeSort (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Sortable.MergeSort

Pretty a => MemoryStructure (SMergeSort (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Sortable.Scheduled

Pretty a => MemoryStructure (FingerTree v (PrettyCell a)) Source # 
Instance details

Defined in Test.Credit.Finger

Pretty a => MemoryStructure (Pairing (PrettyCell a) :: (Type -> Type) -> Type) Source # 
Instance details

Defined in Test.Credit.Heap.Pairing

Pretty a => MemoryStructure (Batched (PrettyCell a) :: (Type -> Type) -> Type) Source # 
Instance details

Defined in Test.Credit.Queue.Batched

MemoryStructure (q (PrettyCell a)) => MemoryStructure (BD q a) Source # 
Instance details

Defined in Test.Credit.Deque.Base

Methods

prettyStructure :: MonadMemory m => BD q a m -> m Memory Source #

MemoryStructure (q (PrettyCell a)) => MemoryStructure (D q a) Source # 
Instance details

Defined in Test.Credit.Deque.Base

Methods

prettyStructure :: MonadMemory m => D q a m -> m Memory Source #

MemoryStructure (h (PrettyCell a)) => MemoryStructure (BH h a) Source # 
Instance details

Defined in Test.Credit.Heap.Base

Methods

prettyStructure :: MonadMemory m => BH h a m -> m Memory Source #

MemoryStructure (h (PrettyCell a)) => MemoryStructure (H h a) Source # 
Instance details

Defined in Test.Credit.Heap.Base

Methods

prettyStructure :: MonadMemory m => H h a m -> m Memory Source #

MemoryStructure (q (PrettyCell a)) => MemoryStructure (Q q a) Source # 
Instance details

Defined in Test.Credit.Queue.Base

Methods

prettyStructure :: MonadMemory m => Q q a m -> m Memory Source #

MemoryStructure (q (PrettyCell a)) => MemoryStructure (RA q a) Source # 
Instance details

Defined in Test.Credit.RandomAccess.Base

Methods

prettyStructure :: MonadMemory m => RA q a m -> m Memory Source #

MemoryStructure (q (PrettyCell a)) => MemoryStructure (S q a) Source # 
Instance details

Defined in Test.Credit.Sortable.Base

Methods

prettyStructure :: MonadMemory m => S q a m -> m Memory Source #