<div dir="ltr"><div>Hi,</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>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.</div></blockquote><div> </div><div>I think the intuition I followed so far was "bindings with unlifted *RHS* are strict".</div><div>So if I take a program in a strict language with Haskell syntax (Idris with a different syntax, not like -XStrict) and replace all types with their unlifted counterparts (which should be possible once we have -XUnliftedDatatypes), then I get exactly the same semantics in GHC Haskell. I find this property very useful.<br></div><div>As a special case that means that any binders of unlifted type are bound strictly, if only for uniformity with simple variable bindings. I think my intuition is different to Richard's rule only for the "unlifted constructor match with nested lifted-only variable matches" case.<br></div><div><br></div><div>Sebastian<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Am Do., 3. Sept. 2020 um 14:48 Uhr schrieb Spiwack, Arnaud <<a href="mailto:arnaud.spiwack@tweag.io">arnaud.spiwack@tweag.io</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>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?</div></div></blockquote><div><br></div><div>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.</div><div><br></div><div>That being said</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>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.</div></blockquote><div><br></div><div> 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.</div><div><br></div><div>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?)<br></div></div>
_______________________________________________<br>
ghc-devs mailing list<br>
<a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><br>
</blockquote></div>