Implicit reboxing of unboxed tuple in let-patterns

Spiwack, Arnaud arnaud.spiwack at tweag.io
Thu Sep 3 16:10:49 UTC 2020


>
> Right now, there is one rule: if the type of any variable bound in the
>> pattern is unlifted, then the pattern is an unlifter-var pattern and is
>> strict.
>>
>
> I think the intuition I followed so far was "bindings with unlifted *RHS*
> are strict".
>

 This is a very different rule indeed! And one which gives a strict
semantic to the initial offender.

But there are holes in it: if I `let (x, y) = blah in …` and `x` is at an
unlifted type, the pattern _needs_ to be strict (this is solved by the
current rule as described by Richard) despite the rhs being at a lifted
type. That's because binding `x` forces the pattern anyway, by definition.
There are questions about nested patterns, as well. What about `let (U x,
y) = blah in …`, where `U` is some unlifted type. Is the nested `U x`
pattern strict? or is it lazy? There is no corresponding right-hand side.

This is all a tad tricky, I must say.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20200903/50406fc4/attachment.html>


More information about the ghc-devs mailing list