<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi all,<div class=""><br class=""></div><div class="">I have been assigned to shepherd Proposal #522, Or patterns.</div><div class=""><br class=""></div><div class="">Proposal text: <a href="https://github.com/knothed/ghc-proposals/blob/master/proposals/0522-or-patterns.rst" class="">https://github.com/knothed/ghc-proposals/blob/master/proposals/0522-or-patterns.rst</a></div><div class="">Proposal discussion: <a href="https://github.com/ghc-proposals/ghc-proposals/pull/522" class="">https://github.com/ghc-proposals/ghc-proposals/pull/522</a></div><div class=""><br class=""></div><div class="">The proposal introduces a syntax for or-patterns. Here is an example:</div><div class=""><br class=""></div><div class="">case ... of</div><div class="">  K1 a b c -> Just ...</div><div class="">  K2 d e -> Just ...</div><div class="">  (K3 {} ; K4 {} ; K5 {}) -> Nothing</div><div class=""><br class=""></div><div class=""><b class="">Summary</b></div><div class=""><br class=""></div><div class="">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.</div><div class=""><br class=""></div><div class="">The authors include a nice section (<a href="https://github.com/knothed/ghc-proposals/blob/master/proposals/0522-or-patterns.rst#id12" class="">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.</div><div class=""><br class=""></div><div class="">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.</div><div class=""><br class=""></div><div class="">Two implementors are named in the proposal.</div><div class=""><br class=""></div><div class=""><b class="">Recommendation</b></div><div class=""><b class=""><br class=""></b></div><div class="">I recommend acceptance. This proposal is relatively simple, will lead to a nice quality-of-life improvement, is future-compatible (*) with or-patterns that <i class="">do</i><span style="font-style: normal;" class=""> bind variables/contexts/existentials, and has a natural reading to users unfamiliar with the extension.</span></div><div class=""><span style="font-style: normal;" class=""><br class=""></span></div><div class=""><span style="font-style: normal;" class="">(*): 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.</span></div><div class=""><span style="font-style: normal;" class=""><br class=""></span></div><div class=""><span style="font-style: normal;" class="">The downsides are:</span></div><div class=""><span style="font-style: normal;" class=""> - Yet another feature to think about, including a new extension name.</span></div><div class=""><span style="font-style: normal;" class=""> - Yet another feature to implement and maintain.</span></div><div class=""><span style="font-style: normal;" class=""><br class=""></span></div><div class="">I think the improvements to the language are worth these downsides, though I could be convinced otherwise.</div><div class=""><br class=""></div><div class="">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.</div><div class=""><br class=""></div><div class="">Thanks!</div><div class="">Richard</div></body></html>