Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data.Macaw.Utils.IncComp
Description
This defines types for performing a computation that log progress incrementally before completing.
Synopsis
- data IncComp l r
- = IncCompLog !l (IncComp l r)
- | IncCompDone !r
- incCompResult :: IncComp l r -> r
- processIncCompLogs :: Monad m => (l -> m ()) -> IncComp l r -> m r
- newtype IncCompM l r a = IncCompTM {
- _unIncCompTM :: Cont (IncComp l r) a
- runIncCompM :: IncCompM l r r -> IncComp l r
- liftIncComp :: (l -> k) -> IncComp l a -> IncCompM k r a
- liftFoldIncComp :: (l -> IncComp k r -> IncComp k r) -> IncComp l a -> IncCompM k r a
- joinIncComp :: (l -> k) -> (a -> IncComp k b) -> IncComp l a -> IncComp k b
- incCompLog :: l -> IncCompM l r ()
- incCompDone :: r -> IncCompM l r a
- newtype ContT (r :: k) (m :: k -> Type) a = ContT {
- runContT :: (a -> m r) -> m r
Documentation
IncComp l r
is an incremental computation.
This is effectively a lazy list of l
values terminated by an r
value.
Constructors
IncCompLog !l (IncComp l r) | Log a message |
IncCompDone !r | Computation complete. |
incCompResult :: IncComp l r -> r Source #
processIncCompLogs :: Monad m => (l -> m ()) -> IncComp l r -> m r Source #
newtype IncCompM l r a Source #
Continuation monad that yields an incremental computation.
Constructors
IncCompTM | |
Fields
|
Instances
Applicative (IncCompM l r) Source # | |
Defined in Data.Macaw.Utils.IncComp | |
Functor (IncCompM l r) Source # | |
Monad (IncCompM l r) Source # | |
runIncCompM :: IncCompM l r r -> IncComp l r Source #
liftIncComp :: (l -> k) -> IncComp l a -> IncCompM k r a Source #
Lift a incremental computation to the monad with the given modification
liftFoldIncComp :: (l -> IncComp k r -> IncComp k r) -> IncComp l a -> IncCompM k r a Source #
Allows a incremental computation to be merged into an existing one by folding over events.
incCompLog :: l -> IncCompM l r () Source #
Log a warning
incCompDone :: r -> IncCompM l r a Source #
Terminate computation early.
newtype ContT (r :: k) (m :: k -> Type) a #
The continuation monad transformer.
Can be used to add continuation handling to any type constructor:
the Monad
instance and most of the operations do not require m
to be a monad.
ContT
is not a functor on the category of monads, and many operations
cannot be lifted through it.
Instances
MonadAccum w m => MonadAccum w (ContT r m) | The continuation can see, and interact with, the accumulated value. Since: mtl-2.3 | ||||
MonadReader r' m => MonadReader r' (ContT r m) | |||||
MonadSelect r' m => MonadSelect r' (ContT r m) | The continuation describes a way of choosing a 'search' or 'ranking'
strategy for Since: mtl-2.3 | ||||
Defined in Control.Monad.Select | |||||
MonadState s m => MonadState s (ContT r m) | |||||
MonadTrans (ContT r) | |||||
Defined in Control.Monad.Trans.Cont | |||||
MonadFail m => MonadFail (ContT r m) | |||||
Defined in Control.Monad.Trans.Cont | |||||
MonadIO m => MonadIO (ContT r m) | |||||
Defined in Control.Monad.Trans.Cont | |||||
Applicative (ContT r m) | |||||
Defined in Control.Monad.Trans.Cont | |||||
Functor (ContT r m) | |||||
Monad (ContT r m) | |||||
MonadThrow m => MonadThrow (ContT r m) | |||||
Defined in Control.Monad.Catch Methods throwM :: (HasCallStack, Exception e) => e -> ContT r m a # | |||||
MonadCont (ContT r m) | Since: mtl-2.3.1 | ||||
PrimMonad m => PrimMonad (ContT r m) | |||||
Defined in Control.Monad.Primitive Associated Types
| |||||
Generic (ContT r m a) | |||||
Defined in Control.Monad.Trans.Cont Associated Types
| |||||
Wrapped (ContT r m a) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
t ~ ContT r' m' a' => Rewrapped (ContT r m a) t | |||||
Defined in Control.Lens.Wrapped | |||||
type PrimState (ContT r m) | |||||
Defined in Control.Monad.Primitive type PrimState (ContT r m) = PrimState m | |||||
type Rep (ContT r m a) | |||||
Defined in Control.Monad.Trans.Cont | |||||
type Unwrapped (ContT r m a) | |||||
Defined in Control.Lens.Wrapped type Unwrapped (ContT r m a) = (a -> m r) -> m r |