lgtk-0.2: lens-based GUI with Gtk backend

Safe HaskellSafe-Inferred

Control.MLens.ExtRef

Contents

Synopsis

Documentation

Monads with state expansion

class NewRef m => ExtRef m whereSource

Suppose that k is a pure lens, and

s <- extRef r k a0.

The following laws should hold:

  • s is a pure reference.
  • (k . s) behaves exactly as r.
  • The initial value of s is the result of (readRef r >>= setL k a0).

Moreover, (extRef r k a0) should not change the value of r.

The following two operations should be identical:

newRew x
extRef unitLens unitLens x

For examples, see Control.MLens.ExtRef.Pure.Test.

Methods

extRef :: Ref m b -> MLens m a b -> a -> m (Ref m a)Source

Instances

Monad m => ExtRef (Ext i m) 

Applications

undoTrSource

Arguments

:: ExtRef m 
=> (a -> a -> Bool)

equality on state

-> Ref m a

reference of state

-> m (m (Maybe (m ())), m (Maybe (m ())))

undo and redo actions

Undo-redo state transformation