summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya Sergey <ilya.sergey@gmail.com>2013-10-15 14:47:10 +0200
committerIlya Sergey <ilya.sergey@gmail.com>2013-10-15 14:47:10 +0200
commit2eb890fc420ab8d5827eb791c9ac882c1f4d250e (patch)
treec59d789a955126f3d57ed32b1286d06689b86d48
parentb7bd3f93d3c06ec94756fc2699721f00b3e835ef (diff)
downloadhaskell-cardinality.tar.gz
Commentscardinality
-rw-r--r--compiler/stranal/DmdAnal.lhs21
1 files changed, 21 insertions, 0 deletions
diff --git a/compiler/stranal/DmdAnal.lhs b/compiler/stranal/DmdAnal.lhs
index adda04156f..5140eb89a6 100644
--- a/compiler/stranal/DmdAnal.lhs
+++ b/compiler/stranal/DmdAnal.lhs
@@ -866,6 +866,27 @@ iterate twice to be sure of not getting over-optimistic CPR info,
in the case where t turns out to be not-demanded. This is handled
by dmdAnalTopBind.
+Note [On the nature of call demands]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+In a signature environment P, variables f are associated with a usage
+signature <k; t; \phi>, where k is the arity of f. Why does t not
+have enough information to make k redundant?
+
+Consider an example:
+
+h = \f -> \g -> case y of True -> \a -> f (a 1)
+ False -> \b -> b (g 2)
+
+For h the analysis produces the following demand type (handling of
+case-expressions is defined in S3.8):
+
+1*C1(U) -> 1*C1(U) -> 1*C1(U) -> *
+
+At the call site (h f1 g1) having two arguments provided (k = 2) is
+already enough to unleash the inferred demand type. Had we taken k =
+3, as suggested by the demand type, we would not be able to treat this
+case with a non-trivial demand.
Note [NOINLINE and strictness]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~