| | 1 | = Strictness analysis: examples = |
| | 2 | |
| | 3 | Consider: |
| | 4 | |
| | 5 | {{{ |
| | 6 | f g True = 3 |
| | 7 | f g False = g 1 2 |
| | 8 | |
| | 9 | ...f (\ x -> let foo = somethingExpensive in \ y -> ...)... |
| | 10 | }}} |
| | 11 | |
| | 12 | We 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 | |
| | 14 | On the other hand, in: |
| | 15 | {{{ |
| | 16 | foo x y = |
| | 17 | case x of |
| | 18 | A -> \ z -> x*z |
| | 19 | B -> \ z -> x+z |
| | 20 | }}} |
| | 21 | we 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. |