Safe Haskell | Safe-Inferred |
---|
Control.MLens.ExtRef
Documentation
module Control.MLens.NewRef
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 asr
. - 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.