Changes between Initial Version and Version 1 of Commentary/Compiler/StrictnessAnalysis/Examples


Ignore:
Timestamp:
Nov 15, 2006 1:44:59 PM (9 years ago)
Author:
kirsten
Comment:

start examples page

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Compiler/StrictnessAnalysis/Examples

    v1 v1  
     1= Strictness analysis: examples =
     2
     3Consider:
     4
     5{{{
     6f g True = 3
     7f g False = g 1 2
     8
     9...f (\ x -> let foo = somethingExpensive in \ y -> ...)...
     10}}}
     11
     12We want to make sure to figure out that f's argument is demanded with type L1X(L1X(LMX)) -- that is, it may or may not be demanded, but if it is, it's always applied to two arguments. This shows why {{{deferType}}} shouldn't just throw away the argument info: in this case, the {{{(\ x -> ...)}}} expression has a nonstrict demand placed on it, yet we still care about the arguments.
     13
     14On the other hand, in:
     15{{{
     16foo x y =
     17  case x of
     18     A -> \ z -> x*z
     19     B -> \ z -> x+z
     20}}}
     21we want to say that if the result of {{{foo}}} has demand {{{S}}} placed on it (i.e., not a call demand), the body of {{{foo}}} has demand {{{S}}} placed on it, not {{{S(LMX)}}}. So this case needs to be treated differently from the one above.