diff options
| author | Ben Gamari <bgamari.foss@gmail.com> | 2018-12-11 13:34:47 -0500 |
|---|---|---|
| committer | Ben Gamari <ben@smart-cactus.org> | 2018-12-11 14:23:22 -0500 |
| commit | d549c081f19925dd0e4c70d45bded0497c649d49 (patch) | |
| tree | 3675bdefd8309b0d87c5ec9ff20236d8baaa8940 /docs/users_guide/using-warnings.rst | |
| parent | 9e7d58c894571f3c114c4f793b52f9d17c4c57fe (diff) | |
| download | haskell-d549c081f19925dd0e4c70d45bded0497c649d49.tar.gz | |
dmdAnal: Move handling of datacon strictness to mkWWstr_one
Previously datacon strictness was accounted for when we demand analysed a case
analysis. However, this results in pessimistic demands in some cases. For
instance, consider the program (from T10482)
data family Bar a
data instance Bar (a, b) = BarPair !(Bar a) !(Bar b)
newtype instance Bar Int = Bar Int
foo :: Bar ((Int, Int), Int) -> Int -> Int
foo f k =
case f of
BarPair x y -> case burble of
True -> case x of
BarPair p q -> ...
False -> ...
We really should be able to assume that `p` is already evaluated since it came
from a strict field of BarPair.
However, as written the demand analyser can not conclude this since we may end
up in the False branch of the case on `burble` (which places no demand on `x`).
By accounting for the data con strictness later, applied to the demand of the
RHS, we get the strict demand signature we want.
See Note [Add demands for strict constructors] for a more comprehensive
discussion.
Test Plan: Validate
Reviewers: simonpj, osa1, goldfire
Subscribers: rwbarton, carter
GHC Trac Issues: #15696
Differential Revision: https://phabricator.haskell.org/D5226
Diffstat (limited to 'docs/users_guide/using-warnings.rst')
0 files changed, 0 insertions, 0 deletions
