| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Mikan.Utils.Update
Description
Computations that track a dirty bit.
Synopsis
- class Monad m => MonadChange (m :: Type -> Type) where
- tellDirty :: m ()
- listenDirty :: m a -> m (a, Bool)
- data ChangeT (m :: Type -> Type) a
- type Change a = ChangeT Identity a
- runChangeT :: Functor m => ChangeT m a -> m (a, Bool)
- runChange :: Change a -> (a, Bool)
- mapChangeT :: (m (a, Any) -> n (b, Any)) -> ChangeT m a -> ChangeT n b
- type UpdaterT (m :: Type -> Type) a = a -> ChangeT m a
- type Updater a = UpdaterT Identity a
- runUpdaterT :: Functor m => UpdaterT m a -> a -> m (a, Bool)
- evalUpdater :: Updater a -> a -> a
- dirty :: forall (m :: Type -> Type) a. Monad m => UpdaterT m a
- sharing :: forall (m :: Type -> Type) a. Monad m => UpdaterT m a -> UpdaterT m a
Documentation
class Monad m => MonadChange (m :: Type -> Type) where Source #
The class of change monads.
Methods
Mark a computation as having changed something.
listenDirty :: m a -> m (a, Bool) Source #
Check to see if a computation changed anything.
Instances
| MonadChange Identity Source # | Always assume change has happened. |
| Monad m => MonadChange (ChangeT m) Source # | |
| Monad m => MonadChange (IdentityT m) Source # | Always assume change has happened. |
The ChangeT monad transformer
data ChangeT (m :: Type -> Type) a Source #
The ChangeT monad transformer, which tracks a single dirty bit.
Instances
runChangeT :: Functor m => ChangeT m a -> m (a, Bool) Source #
Run a ChangeT computation, returning result plus change flag.
runChange :: Change a -> (a, Bool) Source #
Run a Change computation, returning result plus change flag.
mapChangeT :: (m (a, Any) -> n (b, Any)) -> ChangeT m a -> ChangeT n b Source #
Map a ChangeT computation (monad transformer action).
Updaters
evalUpdater :: Updater a -> a -> a Source #
Evaluate an updater using sharing.