[commit: ghc] wip/T9783: In pattern synonym matchers, support unboxed continuation results (fixes #9783). (65f32ae)
git at git.haskell.org
git at git.haskell.org
Sat Nov 8 06:01:35 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/T9783
Link : http://ghc.haskell.org/trac/ghc/changeset/65f32aed54fb9a0ff2afb953eb17c9b2603ce8f9/ghc
>---------------------------------------------------------------
commit 65f32aed54fb9a0ff2afb953eb17c9b2603ce8f9
Author: Dr. ERDI Gergo <gergo at erdi.hu>
Date: Sat Nov 8 12:24:55 2014 +0800
In pattern synonym matchers, support unboxed continuation results (fixes #9783).
This requires ensuring the continuations have arguments by adding a dummy
Void# argument when needed. This is so that matching on a pattern synonym
is lazy even when the result is unboxed, e.g.
pattern P = ()
f P = 0#
In this case, without dummy arguments, the generated matcher's type would be
$mP :: forall (r :: ?). () -> r -> r -> r
which is called in `f` at type `() -> Int# -> Int# -> Int#`,
so it would be strict, in particular, in the failure continuation
of `patError`.
We work around this by making sure both continuations have arguments:
$mP :: forall (r :: ?). () -> (Void# -> r) -> (Void# -> r) -> r
Of course, if `P` (and thus, the success continuation) has any arguments,
we are only adding the extra dummy argument to the failure continuation.
>---------------------------------------------------------------
65f32aed54fb9a0ff2afb953eb17c9b2603ce8f9
compiler/basicTypes/PatSyn.lhs | 29 ++++++++++++++++------
compiler/deSugar/DsUtils.lhs | 4 ++-
compiler/typecheck/TcPatSyn.lhs | 28 +++++++++++----------
testsuite/.gitignore | 1 +
testsuite/tests/patsyn/should_run/T9783.hs | 15 +++++++++++
.../tests/patsyn/should_run/T9783.stdout | 2 +-
testsuite/tests/patsyn/should_run/all.T | 1 +
7 files changed, 57 insertions(+), 23 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 65f32aed54fb9a0ff2afb953eb17c9b2603ce8f9
More information about the ghc-commits
mailing list