Agda-2.4.2: A dependently typed functional programming language and proof assistant

Safe HaskellNone

Agda.Utils.Update

Synopsis

Documentation

data Change a Source

The Change monad.

Instances

Monad Change 
Functor Change 
Applicative Change 
MonadChange Change 

class Monad m => MonadChange m whereSource

The class of change monads.

Methods

tellDirtySource

Arguments

:: m ()

Mark computation as having changed something.

listenDirty :: m a -> m (a, Bool)Source

Instances

MonadChange Identity

A mock change monad.

MonadChange Change 

runChange :: Change a -> (a, Bool)Source

Run a Change computation, returning result plus change flag.

type Updater a = a -> Change aSource

sharing :: Updater a -> Updater aSource

Replace result of updating with original input if nothing has changed.

runUpdater :: Updater a -> a -> (a, Bool)Source

Blindly run an updater.

dirty :: Updater aSource

Mark a computation as dirty.

ifDirty :: MonadChange m => m a -> (a -> m b) -> (a -> m b) -> m bSource

class Traversable f => Updater1 f whereSource

Like Functor, but preserving sharing.

Methods

updater1 :: Updater a -> Updater (f a)Source

updates1Source

Arguments

:: Updater a 
-> Updater (f a)
= sharing . updater1

update1 :: Updater a -> EndoFun (f a)Source

Instances

Updater1 [] 
Updater1 Maybe 

class Updater2 f whereSource

Like Bifunctor, but preserving sharing.

Methods

updater2 :: Updater a -> Updater b -> Updater (f a b)Source

updates2 :: Updater a -> Updater b -> Updater (f a b)Source

update2 :: Updater a -> Updater b -> EndoFun (f a b)Source

Instances

Updater2 Either 
Updater2 (,)