[commit: ghc] ghc-8.0: Fix and refactor strict pattern bindings (649cb34)
git at git.haskell.org
git at git.haskell.org
Sat Feb 27 14:40:08 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : ghc-8.0
Link : http://ghc.haskell.org/trac/ghc/changeset/649cb346a38684df2e932987065817c5cafc2d90/ghc
>---------------------------------------------------------------
commit 649cb346a38684df2e932987065817c5cafc2d90
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
(cherry picked from commit e3f341f334d89c88f388d8e864ed8762d0890a64)
>---------------------------------------------------------------
649cb346a38684df2e932987065817c5cafc2d90
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 649cb346a38684df2e932987065817c5cafc2d90
More information about the ghc-commits
mailing list