summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-12-08 16:58:01 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-12-11 03:55:51 -0500
commitab24ed9bdb1d1b6967883f47eb432c08477d26a9 (patch)
treeecea8f9a9d02190d86db015e9efd993507425038
parent6484f0d72a9110c5960b9185f239e6ce049b0c74 (diff)
downloadhaskell-ab24ed9bdb1d1b6967883f47eb432c08477d26a9.tar.gz
users guide: Fix syntax errors
Fixes errors introduced by 3a55b3a2574f913d046f3a6f82db48d7f6df32e3.
-rw-r--r--docs/users_guide/using-optimisation.rst44
1 files changed, 21 insertions, 23 deletions
diff --git a/docs/users_guide/using-optimisation.rst b/docs/users_guide/using-optimisation.rst
index a962a7f55e..403faa342e 100644
--- a/docs/users_guide/using-optimisation.rst
+++ b/docs/users_guide/using-optimisation.rst
@@ -1197,16 +1197,16 @@ by saying ``-fno-wombat``.
This is the full syntax for cardinalities, demands and sub-demands in BNF:
- .. code-block::
+ .. code-block:: none
- card ::= B | A | 1 | U | S | M semantics as in the table above
+ card ::= B | A | 1 | U | S | M semantics as in the table above
- d ::= card sd card = how often, sd = how deep
- | card abbreviation: Same as "card card"
+ d ::= card sd card = how often, sd = how deep
+ | card abbreviation: Same as "card card"
- sd ::= card polymorphic sub-demand, card at every level
- | P(d,d,..) product sub-demand
- | Ccard(sd) call sub-demand
+ sd ::= card polymorphic sub-demand, card at every level
+ | P(d,d,..) product sub-demand
+ | Ccard(sd) call sub-demand
For example, ``fst`` is strict in its argument, and also in the first
component of the argument. It will not evaluate the argument's second
@@ -1234,17 +1234,17 @@ by saying ``-fno-wombat``.
We summarise a function's demand properties in its *demand signature*.
This is the general syntax:
- .. code-block::
+ .. code-block:: none
- {x->dx,y->dy,z->dz...}<d1><d2><d3>...<dn>div
- ^ ^ ^ ^ ^ ^
- | | | | | |
- | \---+---+------/ |
- | | |
- demand on free demand on divergence
- variables arguments information
- (omitted if empty) (omitted if
- no information)
+ {x->dx,y->dy,z->dz...}<d1><d2><d3>...<dn>div
+ ^ ^ ^ ^ ^ ^
+ | | | | | |
+ | \---+---+------/ |
+ | | |
+ demand on free demand on divergence
+ variables arguments information
+ (omitted if empty) (omitted if
+ no information)
We summarise ``fst``'s demand properties in its *demand signature*
``<SP(SU,A)>``, which just says "If ``fst`` is applied to one argument,
@@ -1260,13 +1260,11 @@ by saying ``-fno-wombat``.
**Call sub-demands**
- Consider ``maybe``:
+ Consider ``maybe``: ::
- .. code-block::
-
- maybe :: b -> (a -> b) -> Maybe a -> b
- maybe n _ Nothing = n
- maybe _ s (Just a) = s a
+ maybe :: b -> (a -> b) -> Maybe a -> b
+ maybe n _ Nothing = n
+ maybe _ s (Just a) = s a
We give it demand signature ``<U><1C1(U)><SU>``. The ``C1(U)`` is a *call
sub-demand* that says "Called at most once, where the result is used