@@ -90,25 +90,21 @@ import Foreign.Storable
9090
9191-- | A concrete implementation of a readable and writable state variable,
9292-- carrying one IO action to read the value and another IO action to write the
93- -- new value.
93+ -- new value. This data type represents a piece of mutable, imperative state
94+ -- with possible side-effects. These tend to encapsulate all sorts tricky
95+ -- behavior in external libraries, and may well throw exceptions. Inhabitants
96+ -- __should__ satsify the following properties:
9497--
95- -- This data type represents a piece of mutable, imperative state
96- -- with possible side-effects. These tend to encapsulate all sorts
97- -- tricky behavior in external libraries, and may well throw
98- -- exceptions.
99- --
100- -- Inhabitants __should__ satsify the following properties.
101- --
102- -- In the absence of concurrent mutation from other threads or a
103- -- thrown exception:
98+ -- * In the absence of concurrent mutation from other threads or a thrown
99+ -- exception:
104100--
105101-- @
106102-- do x <- 'get' v; v '$=' y; v '$=' x
107103-- @
108104--
109105-- should restore the previous state.
110106--
111- -- Ideally, in the absence of thrown exceptions:
107+ -- * Ideally, in the absence of thrown exceptions:
112108--
113109-- @
114110-- v '$=' a >> 'get' v
@@ -196,6 +192,7 @@ instance HasSetter (TVar a) a where
196192
197193infixr 2 $~ , $~!
198194
195+ -- | This is the class of all updatable state variables.
199196class HasSetter t a => HasUpdate t a b | t -> a b where
200197 -- | Transform the contents of a state variable with a given funtion.
201198 ($~) :: MonadIO m => t -> (a -> b ) -> m ()
@@ -250,6 +247,7 @@ instance HasUpdate (TVar a) a a where
250247-- * HasGetter
251248--------------------------------------------------------------------
252249
250+ -- | This is the class of all readable state variables.
253251class HasGetter t a | t -> a where
254252 get :: MonadIO m => t -> m a
255253
0 commit comments