| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Vgrep.Type
Description
The VgrepT monad transformer allows reading from the Environment
and changing the state of the App or a Widget.
Synopsis
- data VgrepT s m a
- type Vgrep s = VgrepT s Identity
- mkVgrepT :: Monad m => (s -> Environment -> m (a, s)) -> VgrepT s m a
- runVgrepT :: Monad m => VgrepT s m a -> s -> Environment -> m (a, s)
- modifyEnvironment :: Monad m => (Environment -> Environment) -> VgrepT s m ()
- vgrepBracket :: IO a -> (a -> IO c) -> (a -> VgrepT s IO b) -> VgrepT s IO b
- lift :: (MonadTrans t, Monad m) => m a -> t m a
- hoist :: forall m n (b :: k). (MFunctor t, Monad m) => (forall a. m a -> n a) -> t m b -> t n b
- module Vgrep.Environment
- modify :: MonadState s m => (s -> s) -> m ()
- class Monad m => MonadReader r (m :: Type -> Type) | m -> r where
- class Monad m => MonadState s (m :: Type -> Type) | m -> s where
The VgrepT monad transformer
Instances
| Monad m => MonadReader Environment (VgrepT s m) Source # |
|
Defined in Vgrep.Type Methods ask :: VgrepT s m Environment # local :: (Environment -> Environment) -> VgrepT s m a -> VgrepT s m a # reader :: (Environment -> a) -> VgrepT s m a # | |
| Monad m => MonadState s (VgrepT s m) Source # | |
| MonadTrans (VgrepT s) Source # | |
Defined in Vgrep.Type | |
| MFunctor (VgrepT s :: (Type -> Type) -> Type -> Type) Source # | |
| Monad m => Monad (VgrepT s m) Source # | |
| Functor m => Functor (VgrepT s m) Source # | |
| Monad m => Applicative (VgrepT s m) Source # | |
| MonadIO m => MonadIO (VgrepT s m) Source # | |
Defined in Vgrep.Type | |
| Monad m => Zoom (VgrepT s m) (VgrepT t m) s t Source # | |
| type Zoomed (VgrepT s m) Source # | |
Defined in Vgrep.Type | |
mkVgrepT :: Monad m => (s -> Environment -> m (a, s)) -> VgrepT s m a Source #
Lift a monadic action to VgrepT.
runVgrepT :: Monad m => VgrepT s m a -> s -> Environment -> m (a, s) Source #
Pass an initial state and an Environment and reduce a VgrepT
action to an action in the base monad.
Modifying the environment
modifyEnvironment :: Monad m => (Environment -> Environment) -> VgrepT s m () Source #
The Environment of VgrepT is not stateful, however it can be
modified globally. An example is resizing the application by changing
the display bounds.
Utilities
Re-exports
lift :: (MonadTrans t, Monad m) => m a -> t m a #
Lift a computation from the argument monad to the constructed monad.
hoist :: forall m n (b :: k). (MFunctor t, Monad m) => (forall a. m a -> n a) -> t m b -> t n b #
Lift a monad morphism from m to n into a monad morphism from
(t m) to (t n)
The first argument to hoist must be a monad morphism, even though the
type system does not enforce this
module Vgrep.Environment
modify :: MonadState s m => (s -> s) -> m () #
Monadic state transformer.
Maps an old state to a new state inside a state monad. The old state is thrown away.
Main> :t modify ((+1) :: Int -> Int)
modify (...) :: (MonadState Int a) => a ()This says that modify (+1) acts over any
Monad that is a member of the MonadState class,
with an Int state.
class Monad m => MonadReader r (m :: Type -> Type) | m -> r where #
See examples in Control.Monad.Reader.
Note, the partially applied function type (->) r is a simple reader monad.
See the instance declaration below.
Methods
Retrieves the monad environment.
Arguments
| :: (r -> r) | The function to modify the environment. |
| -> m a |
|
| -> m a |
Executes a computation in a modified environment.
Instances
class Monad m => MonadState s (m :: Type -> Type) | m -> s where #
Minimal definition is either both of get and put or just state
Methods
Return the state from the internals of the monad.
Replace the state inside the monad.
Instances
| MonadState s m => MonadState s (MaybeT m) | |
| MonadState s m => MonadState s (ListT m) | |
| MonadState s m => MonadState s (ListT m) | |
| MonadState s m => MonadState s (ResourceT m) | |
| (Monoid w, MonadState s m) => MonadState s (WriterT w m) | |
| (Monoid w, MonadState s m) => MonadState s (WriterT w m) | |
| Monad m => MonadState s (StateT s m) | |
| Monad m => MonadState s (StateT s m) | |
| MonadState s m => MonadState s (ReaderT r m) | |
| MonadState s m => MonadState s (IdentityT m) | |
| MonadState s m => MonadState s (ExceptT e m) | Since: mtl-2.2 |
| (Error e, MonadState s m) => MonadState s (ErrorT e m) | |
| Monad m => MonadState s (VgrepT s m) Source # | |
| MonadState s m => MonadState s (ContT r m) | |
| MonadState s m => MonadState s (ConduitT i o m) | |
| (Monad m, Monoid w) => MonadState s (RWST r w s m) | |
| (Monad m, Monoid w) => MonadState s (RWST r w s m) | |
| MonadState s m => MonadState s (Proxy a' a b' b m) | |
| MonadState s m => MonadState s (Pipe l i o u m) | |