In pattern synonym matchers, support unboxed continuation results (fixes #9783).

Authored by cactus.

Description

In pattern synonym matchers, support unboxed continuation results (fixes Trac #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.

(cherry picked from commit 474e535b6b121809a8d75df5a4c37dc574d3d302)

Details

Committed
cactusDec 19 2014, 8:51 PM
Parents
rGHC615d03a4cab1: Link pre-ARMv6 spinlocks into all RTS variants
Branches
Unknown
Tags
Unknown