diff --git a/ghc/docs/users_guide/glasgow_exts.xml b/ghc/docs/users_guide/glasgow_exts.xml
index c82e36955261ad7089f8963f37ec4a9869c8d650..5a22e7c6addcaf5a011a18f8a8e3f8b68ae5b738 100644
--- a/ghc/docs/users_guide/glasgow_exts.xml
+++ b/ghc/docs/users_guide/glasgow_exts.xml
@@ -3619,8 +3619,8 @@ The first line sends the value of x+1 as an input to
the arrow f, and matches its output against
y.
In the next line, the output is discarded.
-The arrow returnA is defined in the
-Control.Arrow
+The arrow returnA is defined in the
+Control.Arrow
module as arr id.
The above example is treated as an abbreviation for
@@ -3637,7 +3637,7 @@ arr (\ x -> (x, x)) >>>
Note that variables not used later in the composition are projected out.
After simplification using rewrite rules (see )
defined in the
-Control.Arrow
+Control.Arrow
module, this reduces to
arr (\ x -> (x+1, x)) >>>
@@ -3662,14 +3662,14 @@ so polymorphic variables are allowed.
It's also possible to have mutually recursive bindings,
using the new rec keyword, as in the following example:
-
+
counter :: ArrowCircuit a => a Bool Int
counter = proc reset -> do
rec output <- returnA -< if reset then 0 else next
next <- delay 0 -< output+1
returnA -< output
-
-The translation of such forms uses the loop combinator,
+
+The translation of such forms uses the loop combinator,
so the arrow concerned must belong to the ArrowLoop class.
@@ -3693,7 +3693,7 @@ which is translated to
arr (\ (x,y) -> if f x y then Left x else Right y) >>>
(arr (\x -> x+1) >>> f) ||| (arr (\y -> y+2) >>> g)
-Since the translation uses |||,
+Since the translation uses |||,
the arrow concerned must belong to the ArrowChoice class.
@@ -3769,7 +3769,7 @@ and satisfy the corresponding naturality property
arr k >>> (f <+> g) = (arr k >>> f) <+> (arr k >>> g)
at least for strict k.
-(This should be automatic if you're not using seq.)
+(This should be automatic if you're not using seq.)
This ensures that environments seen by the subcommands are environments
of the whole command,
and also allows the translation to safely trim these environments.
@@ -3825,7 +3825,7 @@ we are talking about commands, and something different is going on.
The input to the arrow represented by a command consists of values for
the free local variables in the command, plus a stack of anonymous values.
In all the prior examples, this stack was empty.
-In the second argument to handleA,
+In the second argument to handleA,
this stack consists of one value, the value of the exception.
The command form of lambda merely gives this value a name.
@@ -3833,8 +3833,9 @@ The command form of lambda merely gives this value a name.
More concretely,
the values on the stack are paired to the right of the environment.
-So when designing operators like handleA that pass
-extra inputs to their subcommands,
+So operators like handleA that pass
+extra inputs to their subcommands can be designed for use with the notation
+by pairing the values with the environment in this way.
More precisely, the type of each argument of the operator (and its result)
should have the form
@@ -3862,7 +3863,7 @@ proc x -> do
(|runReader (do { ... })|) s
which adds s to the stack of inputs to the command
-built using runReader.
+built using runReader.
@@ -3880,7 +3881,7 @@ u `bind` f = returnA &&& u >>> f
bind_ :: Arrow a => a e b -> a e c -> a e c
u `bind_` f = u `bind` (arr fst >>> f)
-We could simulate do by defining
+We could simulate if by defining
cond :: ArrowChoice a => a e b -> a e b -> a (e,Bool) b
cond f g = arr (\ (e,b) -> if b then Left e else Right e) >>> f ||| g
@@ -3931,7 +3932,7 @@ additional restrictions:
The module must import
-Control.Arrow.
+Control.Arrow.