Implicit reboxing of unboxed tuple in let-patterns

Spiwack, Arnaud arnaud.spiwack at tweag.io
Thu Sep 3 12:47:15 UTC 2020


>
> This thread is suggesting to add a special case -- one that seems to match
> intuition, but it's still a special case. And my question is: should the
> special case be for unboxed tuples? or should the special case be for any
> pattern whose overall type is unlifted?
>

My intuition would be: for all unlifted types. I'd submit that the
distinction between lazy and strict pattern-matching doesn't really make a
ton of sense for unlifted types. To implement lazy pattern-matching on an
unlifted type, one has to actually indirect through another type, which I
find deeply suspicious.

That being said

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. The pattern must be banged, unless the bound variable is not
> nested. This rule is consistent across all features.
>

 I realise that there are a lot of subtil details to get right to specify
pattern-matching. Or at the very least, that it's difficult to come up with
a straightforward specification which is as clear as the one above.

I'm wondering though: have there been discussions which led to the above
rule, or did it just come to be, mostly informally? (and if there have been
explicit discussions, are they recorded somewhere?)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20200903/0acc2dc4/attachment.html>


More information about the ghc-devs mailing list