[GHC] #9783: Pattern synonym matcher is unnecessarily strict on unboxed continuations
GHC
ghc-devs at haskell.org
Sat Nov 8 08:21:39 UTC 2014
#9783: Pattern synonym matcher is unnecessarily strict on unboxed continuations
-------------------------------------+-------------------------------------
Reporter: cactus | Owner: cactus
Type: bug | Status: new
Priority: normal | Milestone: 7.10.1
Component: Compiler | Version: 7.8.3
(Type checker) | Keywords: pattern synonyms
Resolution: | Architecture: Unknown/Multiple
Operating System: | Difficulty: Moderate (less
Unknown/Multiple | than a day)
Type of failure: Incorrect | Blocked By:
result at runtime | Related Tickets: 9732
Test Case: |
Blocking: |
Differential Revisions: |
-------------------------------------+-------------------------------------
Comment (by Dr. ERDI Gergo <gergo@…>):
In [changeset:"474e535b6b121809a8d75df5a4c37dc574d3d302/ghc"]:
{{{
#!CommitTicketReference repository="ghc"
revision="474e535b6b121809a8d75df5a4c37dc574d3d302"
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.
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9783#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list