@@ -19,10 +19,10 @@ how those resources change when a function runs:
1919 Type
2020
2121A value of type ``STrans m resultType in_res out_res_fn`` represents a sequence
22−of actions which can manipulate state. The arguments are:
22+of actions which can manipulate state. The arguments are:
2323
2424* ``m``, which is an underlying *computation context* in which the actions will be executed.
25− Usually, this will be a generic type with a ``Monad`` implementation, but
25+ Usually, this will be a generic type with a ``Monad`` implementation, but
2626 it isn't necessarily so. In particular, there is no need to understand monads
2727 to be able to use ``ST`` effectively!
2828* ``resultType``, which is the type of the value the sequence will produce
@@ -76,10 +76,10 @@ resource is still a ``State Integer`` on output:
7676 same. We'll introduce a much more concise way of writing this type at the
7777 end of this section (:ref:`sttype`), when we describe the ``ST`` type
7878 itself.
79−
79+
8080This function reads the value stored at the resource ``x`` with ``read``,
8181increments it then writes the result back into the resource ``x`` with
82−``write``. We'll see the types of ``read`` and ``write`` shortly
82+``write``. We'll see the types of ``read`` and ``write`` shortly
8383(see :ref:`stransprimops`). We can also create and delete resources:
8484
8585.. code-block:: idris
@@ -104,7 +104,7 @@ can run it in *any* context. We can run it in the identity context with
104104``runPure``. For example, try entering the above definitions in a file
105105``Intro.idr`` then running the following at the REPL:
106106
107−.. code::
107+.. code::
108108
109109 *Intro> runPure (makeAndIncrement 93)
110110 94 : Integer
@@ -179,7 +179,7 @@ of ``lift`` shortly.
179179 Conceptually, at least, you can think of it as having the following type:
180180
181181 .. code-block:: idris
182−
182+
183183 (!) : STrans m a state_in state_out -> a
184184
185185 It is syntactic sugar for binding a variable immediately before the
@@ -243,7 +243,7 @@ context. Here, we use ``run``, which allows us to execute an ``STrans`` program
243243in any context (as long as it has an implementation of ``Applicative``) and we
244244can execute ``ioMakeAndIncrement`` at the REPL as follows:
245245
246−.. code::
246+.. code::
247247
248248 *Intro> :exec run ioMakeAndIncrement
249249 Enter a number: 93
@@ -269,7 +269,7 @@ its length will change:
269269 addElement vec item = do xs <- read vec
270270 write vec (item :: xs)
271271
272−Note that you'll need to ``import Data.Vect`` to try this example.
272+Note that you'll need to ``import Data.Vect`` to try this example.
273273
274274.. topic:: Updating a state directly with ``update``
275275
@@ -344,7 +344,7 @@ if the input is valid. We can express this in the type as follows:
344344Then, when we implement ``readAndAdd`` we need to return the appropriate
345345value for the output state. If we've added an item to the vector, we need to
346346return ``True``, otherwise we need to return ``False``:
347−
347+
348348.. code-block:: idris
349349
350350 readAndAdd : ConsoleIO io => (vec : Var) ->
@@ -435,7 +435,7 @@ we can do as follows:
435435
436436.. _stransprimops:
437437
438−``STrans`` Primitive operations
438+``STrans`` Primitive operations
439439===============================
440440
441441Now that we've written a few small examples of ``STrans`` functions, it's
@@ -485,7 +485,7 @@ of type ``State state``:
485485
486486.. code-block:: idris
487487
488− new : (val : state) ->
488+ new : (val : state) ->
489489 STrans m Var res (\lbl => (lbl ::: State state) :: res)
490490
491491It's important that the new resource has type ``State state``, rather than
@@ -526,7 +526,7 @@ the resource list so that it is appropriate for returning that value:
526526
527527.. code-block:: idris
528528
529− returning : (result : ty) ->
529+ returning : (result : ty) ->
530530 STrans m () res (const (out_fn result)) ->
531531 STrans m ty res out_fn
532532
@@ -555,7 +555,7 @@ programming and reasoning in Idris.
555555.. _sttype:
556556
557557`ST`: Representing state transitions directly
558−============================================
558+=============================================
559559
560560We've seen a few examples of small ``STrans`` functions now, and
561561their types can become quite verbose given that we need to provide explicit
@@ -568,7 +568,7 @@ giving input and output resource lists in full. We can do this with
568568.. code-block:: idris
569569
570570 ST : (m : Type -> Type) ->
571− (resultType : Type) ->
571+ (resultType : Type) ->
572572 List (Action resultType) -> Type
573573
574574``ST`` is a type level function which computes an appropriate ``STrans``
@@ -593,7 +593,7 @@ So, we can write some of the function types we've seen so far as follows:
593593That is, ``increment`` begins and ends with ``x`` in state ``State Integer``.
594594
595595.. code-block:: idris
596−
596+
597597 makeAndIncrement : Int -> ST m Int []
598598
599599That is, ``makeAndIncrement`` begins and ends with no resources.
@@ -652,5 +652,3 @@ the rare occasions we need the full precision of ``STrans``. In the next
652652section, we'll see how to use the facilities provided by ``ST`` to write
653653a precise API for a system with security properties: a data store requiring
654654a login.
655−
656−