[commit: ghc] master: Fix and refactor strict pattern bindings (e3f341f)

git at git.haskell.org git at git.haskell.org
Fri Feb 26 17:14:40 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/e3f341f334d89c88f388d8e864ed8762d0890a64/ghc

>---------------------------------------------------------------

commit e3f341f334d89c88f388d8e864ed8762d0890a64
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Thu Feb 25 15:53:03 2016 +0000

    Fix and refactor strict pattern bindings
    
    This patch was triggered by Trac #11601, where I discovered that
    -XStrict was really not doing the right thing. In particular,
    
      f y = let !(Just x) = blah[y] in body[y,x]
    
    This was evaluating 'blah' but not pattern matching it
    against Just until x was demanded.  This is wrong.
    
    The patch implements a new semantics which ensures that strict
    patterns (i.e. ones with an explicit bang, or with -XStrict)
    are evaluated fully when bound.
    
    * There are extensive notes in DsUtils:
      Note [mkSelectorBinds]
    
    * To do this I found I need one-tuples;
      see Note [One-tuples] in TysWiredIn
    
    I updated the user manual to give the new semantics


>---------------------------------------------------------------

e3f341f334d89c88f388d8e864ed8762d0890a64
 compiler/coreSyn/CoreLint.hs                       |   9 +-
 compiler/coreSyn/MkCore.hs                         | 117 +++++---
 compiler/deSugar/DsBinds.hs                        |   8 +-
 compiler/deSugar/DsUtils.hs                        | 308 +++++++++++++--------
 compiler/deSugar/Match.hs                          |  35 +--
 compiler/prelude/TysWiredIn.hs                     |  60 +++-
 docs/users_guide/glasgow_exts.rst                  |  34 +--
 libraries/ghc-prim/GHC/Tuple.hs                    |   5 +
 .../tests/deSugar/should_compile/T5455.stderr      |  10 +-
 testsuite/tests/deSugar/should_run/T11601.hs       |   8 +
 testsuite/tests/deSugar/should_run/T11601.stderr   |   5 +
 testsuite/tests/deSugar/should_run/all.T           |   1 +
 12 files changed, 379 insertions(+), 221 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc e3f341f334d89c88f388d8e864ed8762d0890a64


More information about the ghc-commits mailing list