summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-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 8fec4f1a7b..fb18f41bcc 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