<div dir="ltr"><div>The syntax is quite unsatisfying, reusing a symbol that has a different meaning in expressions. Such a shame that | was used for guards. Oh well. It's a useful feature though, I'm weakly in favour.<br></div><div><br></div><div>Simon<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 2 Sept 2022 at 17:36, Richard Eisenberg <<a href="mailto:lists@richarde.dev">lists@richarde.dev</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Any other thoughts here? I plan to accept next week.<br>
<br>
Thanks,<br>
Richard<br>
<br>
> On Aug 24, 2022, at 7:49 AM, Chris Dornan <<a href="mailto:chris@chrisdornan.com" target="_blank">chris@chrisdornan.com</a>> wrote:<br>
> <br>
> Count me in — yes to Or patterns for me.<br>
> <br>
>> On 2022-08-24, at 11:57, Simon Peyton Jones <<a href="mailto:simon.peytonjones@gmail.com" target="_blank">simon.peytonjones@gmail.com</a>> wrote:<br>
>> <br>
>> I'm mildly in favour of acceptance.  One more thing.  But a reasonably easy thing.<br>
>> <br>
>> Simon<br>
>> <br>
>> On Fri, 19 Aug 2022 at 22:23, Richard Eisenberg <<a href="mailto:lists@richarde.dev" target="_blank">lists@richarde.dev</a>> wrote:<br>
>> Hi all,<br>
>> <br>
>> I have been assigned to shepherd Proposal #522, Or patterns.<br>
>> <br>
>> Proposal text: <a href="https://github.com/knothed/ghc-proposals/blob/master/proposals/0522-or-patterns.rst" rel="noreferrer" target="_blank">https://github.com/knothed/ghc-proposals/blob/master/proposals/0522-or-patterns.rst</a><br>
>> Proposal discussion: <a href="https://github.com/ghc-proposals/ghc-proposals/pull/522" rel="noreferrer" target="_blank">https://github.com/ghc-proposals/ghc-proposals/pull/522</a><br>
>> <br>
>> The proposal introduces a syntax for or-patterns. Here is an example:<br>
>> <br>
>> case ... of<br>
>>  K1 a b c -> Just ...<br>
>>  K2 d e -> Just ...<br>
>>  (K3 {} ; K4 {} ; K5 {}) -> Nothing<br>
>> <br>
>> Summary<br>
>> <br>
>> Without this proposal, the author of the above code would have to either use a _ pattern for the last line, meaning that future new constructors added to the datatype would go unreported by compiler warnings, or to write the K3, K4, and K5 cases separately, repeating the right-hand side. Or-patterns are common in other languages.<br>
>> <br>
>> The authors include a nice section (<a href="https://github.com/knothed/ghc-proposals/blob/master/proposals/0522-or-patterns.rst#id12" rel="noreferrer" target="_blank">https://github.com/knothed/ghc-proposals/blob/master/proposals/0522-or-patterns.rst#id12</a>) on alternative syntax. I recommend reading it; it made me feel better about the proposed semi-colon syntax.<br>
>> <br>
>> The proposal requires that each pattern in an or-pattern must not bind any variables. Any provided contexts (e.g. GADT equalities) and existential variables are ignored, and any required context is combined across the disjuncts in the pattern.<br>
>> <br>
>> Two implementors are named in the proposal.<br>
>> <br>
>> Recommendation<br>
>> <br>
>> I recommend acceptance. This proposal is relatively simple, will lead to a nice quality-of-life improvement, is future-compatible (*) with or-patterns that do bind variables/contexts/existentials, and has a natural reading to users unfamiliar with the extension.<br>
>> <br>
>> (*): I suppose that the fact that an or-pattern discards equalities might mean that a later improvement that retains these equalities might interfere with type inference (because in-scope equalities cause type variables to become untouchable). But I will choose not to worry about this.<br>
>> <br>
>> The downsides are:<br>
>> - Yet another feature to think about, including a new extension name.<br>
>> - Yet another feature to implement and maintain.<br>
>> <br>
>> I think the improvements to the language are worth these downsides, though I could be convinced otherwise.<br>
>> <br>
>> Please let me know what you think about this proposal. I'm hoping to accept this proposal in three weeks (a bit longer than my usual timeframe, due to it being a popular time for holidays), unless there is objection.<br>
>> <br>
>> Thanks!<br>
>> Richard<br>
>> _______________________________________________<br>
>> ghc-steering-committee mailing list<br>
>> <a href="mailto:ghc-steering-committee@haskell.org" target="_blank">ghc-steering-committee@haskell.org</a><br>
>> <a href="https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee" rel="noreferrer" target="_blank">https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee</a><br>
>> _______________________________________________<br>
>> ghc-steering-committee mailing list<br>
>> <a href="mailto:ghc-steering-committee@haskell.org" target="_blank">ghc-steering-committee@haskell.org</a><br>
>> <a href="https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee" rel="noreferrer" target="_blank">https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee</a><br>
> <br>
<br>
_______________________________________________<br>
ghc-steering-committee mailing list<br>
<a href="mailto:ghc-steering-committee@haskell.org" target="_blank">ghc-steering-committee@haskell.org</a><br>
<a href="https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee" rel="noreferrer" target="_blank">https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee</a><br>
</blockquote></div>