| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Control.Monad.Ology.Data.Ref
Synopsis
- data Ref (m :: Type -> Type) a = MkRef {}
- refModify :: Monad m => Ref m a -> (a -> a) -> m ()
- refModifyM :: Monad m => Ref m a -> (a -> m a) -> m ()
- refRestore :: forall (m :: Type -> Type) a. MonadException m => Ref m a -> m --> m
- refPutRestore :: forall (m :: Type -> Type) a. MonadException m => Ref m a -> a -> m --> m
- lensMapRef :: forall (m :: Type -> Type) a b. Monad m => Lens' a b -> Ref m a -> Ref m b
- liftRef :: forall (t :: (Type -> Type) -> Type -> Type) (m :: Type -> Type). (MonadTrans t, Monad m) => Ref m --> Ref (t m)
- stateRef :: forall (m :: Type -> Type) s. Monad m => Ref (StateT s m) s
- refRunState :: forall (m :: Type -> Type) s. Monad m => Ref m s -> StateT s m --> m
- ioRef :: IORef a -> Ref IO a
- strictSTRef :: STRef s a -> Ref (ST s) a
- lazySTRef :: STRef s a -> Ref (ST s) a
- refParam :: forall (m :: Type -> Type) a. MonadException m => Ref m a -> Param m a
- refProd :: forall (m :: Type -> Type) a. (MonadException m, Monoid a) => Ref m a -> Prod m a
Documentation
data Ref (m :: Type -> Type) a Source #
A reference of a monad (as in StateT).
Instances
| Functor m => Invariant (Ref m) Source # | |
Defined in Control.Monad.Ology.Data.Ref | |
| Applicative m => Productable (Ref m) Source # | |
refModifyM :: Monad m => Ref m a -> (a -> m a) -> m () Source #
refRestore :: forall (m :: Type -> Type) a. MonadException m => Ref m a -> m --> m Source #
Restore the original value of this reference after the operation.
refPutRestore :: forall (m :: Type -> Type) a. MonadException m => Ref m a -> a -> m --> m Source #
Put and restore the original value of this reference after the operation.
liftRef :: forall (t :: (Type -> Type) -> Type -> Type) (m :: Type -> Type). (MonadTrans t, Monad m) => Ref m --> Ref (t m) Source #
refRunState :: forall (m :: Type -> Type) s. Monad m => Ref m s -> StateT s m --> m Source #
Run a state monad over this reference.