Proposal: Or patterns #43 (Round 2)

We now have a revised version of the ”Or pattern” proposal #43 to consider: (formatted) https://github.com/osa1/ghc-proposals/blob/or_patterns/proposals/0000-or-pat... (PR thread) https://github.com/ghc-proposals/ghc-proposals/pull/43 You may remember that we discuss this a while back https://mail.haskell.org/pipermail/ghc-steering-committee/2017-November/0002... and finally decided to bounce it back to the authors with the following recommendation: https://github.com/ghc-proposals/ghc-proposals/pull/43#issuecomment-35818932... We previously decided that we are inclined to accept this proposal if the authors change the points that we highlighted. Judging from the conversation of SimonPJ and Richard with the author on the GitHub thread, it appears to me that most of the issues have been addressed. However, Simon’s point • "Patterns that bind existentials, dictionaries, or equalities are rejected by the type checker". I disagree. Earlier I suggested "no variable bound by an or-pattern can have a type that mentions an existential variable bound by the or-pattern". That is much more friendly because you can still match against an existential constructor; you just can’t bind an existential variable. from <https://github.com/ghc-proposals/ghc-proposals/pull/43#issuecomment-36893340... https://github.com/ghc-proposals/ghc-proposals/pull/43#issuecomment-36893340...> still doesn’t seem to be addressed, or am I misunderstanding? Overall, I propose to accept the proposal, possibly requiring that the above point be addressed. What do you all think? Cheers, Manuel

+1, but we should hear from Simon about the existential point.
On 1 June 2018 at 08:30, Manuel M T Chakravarty
We now have a revised version of the ”Or pattern” proposal #43 to consider:
(formatted) https://github.com/osa1/ghc-proposals/blob/or_ patterns/proposals/0000-or-patterns.rst (PR thread) https://github.com/ghc-proposals/ghc-proposals/pull/43
You may remember that we discuss this a while back
https://mail.haskell.org/pipermail/ghc-steering-committee/ 2017-November/000231.html
and finally decided to bounce it back to the authors with the following recommendation:
https://github.com/ghc-proposals/ghc-proposals/pull/43# issuecomment-358189327
We previously decided that we are inclined to accept this proposal if the authors change the points that we highlighted. Judging from the conversation of SimonPJ and Richard with the author on the GitHub thread, it appears to me that most of the issues have been addressed. However, Simon’s point
• "Patterns that bind existentials, dictionaries, or equalities are rejected by the type checker". I disagree. Earlier I suggested "no variable bound by an or-pattern can have a type that mentions an existential variable bound by the or-pattern". That is much more friendly because you can still match against an existential constructor; you just can’t bind an existential variable.
from <https://github.com/ghc-proposals/ghc-proposals/pull/43# issuecomment-368933401> still doesn’t seem to be addressed, or am I misunderstanding?
Overall, I propose to accept the proposal, possibly requiring that the above point be addressed.
What do you all think?
Cheers, Manuel
_______________________________________________ ghc-steering-committee mailing list ghc-steering-committee@haskell.org https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee

See my reply on the Github thread.
Richard what do you think? Can you post the paper?
Simon
From: ghc-steering-committee

The paper is up at https://cs.brynmawr.edu/~rae/papers/2018/pat-tyvars/pat-tyvars.pdf But do see recent conversation on the ticket, as this may be undergoing more revision, allowing, say, existentials to work with this feature. Richard
On Jun 8, 2018, at 6:16 PM, Simon Peyton Jones via ghc-steering-committee
wrote: See my reply on the Github thread. Richard what do you think? Can you post the paper?
Simon
From: ghc-steering-committee
On Behalf Of Simon Marlow Sent: 08 June 2018 20:54 To: Manuel M T Chakravarty Cc: ghc-steering-committee@haskell.org Subject: Re: [ghc-steering-committee] Proposal: Or patterns #43 (Round 2) +1, but we should hear from Simon about the existential point.
On 1 June 2018 at 08:30, Manuel M T Chakravarty
mailto:chak@justtesting.org> wrote: We now have a revised version of the ”Or pattern” proposal #43 to consider: (formatted) https://github.com/osa1/ghc-proposals/blob/or_patterns/proposals/0000-or- https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fosa1%2Fghc-proposals%2Fblob%2For_patterns%2Fproposals%2F0000-or-&data=02%7C01%7Csimonpj%40microsoft.com%7C97aa991a9856484a940e08d5cd798afa%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636640844264137789&sdata=Bkxgi6BdjD1xNptF28bekSybUBT9%2BdtkfIzMiOtpvQQ%3D&reserved=0patterns.rst (PR thread) https://github.com/ghc-proposals/ghc-proposals/pull/43 https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fghc-proposals%2Fghc-proposals%2Fpull%2F43&data=02%7C01%7Csimonpj%40microsoft.com%7C97aa991a9856484a940e08d5cd798afa%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636640844264147806&sdata=lmj6p8TZ9hL096TRiYLMjWGGuLi0m8R0Vr9y5fF30Ug%3D&reserved=0
You may remember that we discuss this a while back
https://mail.haskell.org/pipermail/ghc-steering-committee/2017-November/0002... https://mail.haskell.org/pipermail/ghc-steering-committee/2017-November/0002...
and finally decided to bounce it back to the authors with the following recommendation:
https://github.com/ghc-proposals/ghc-proposals/pull/43#issuecomment-35818932... https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fghc-proposals%2Fghc-proposals%2Fpull%2F43%23issuecomment-358189327&data=02%7C01%7Csimonpj%40microsoft.com%7C97aa991a9856484a940e08d5cd798afa%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636640844264157815&sdata=OfK54e4IqvNRarsHVjtd18xErq7IyY1svOCe2k9LdPQ%3D&reserved=0
We previously decided that we are inclined to accept this proposal if the authors change the points that we highlighted. Judging from the conversation of SimonPJ and Richard with the author on the GitHub thread, it appears to me that most of the issues have been addressed. However, Simon’s point
• "Patterns that bind existentials, dictionaries, or equalities are rejected by the type checker". I disagree. Earlier I suggested "no variable bound by an or-pattern can have a type that mentions an existential variable bound by the or-pattern". That is much more friendly because you can still match against an existential constructor; you just can’t bind an existential variable.
from <https://github.com/ghc-proposals/ghc-proposals/pull/43#issuecomment-36893340... https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fghc-proposals%2Fghc-proposals%2Fpull%2F43%23issuecomment-368933401&data=02%7C01%7Csimonpj%40microsoft.com%7C97aa991a9856484a940e08d5cd798afa%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636640844264157815&sdata=Mk975k%2B0RzaA5CnTu0vUcHbsJqU4QGaiouvHOOv1Z9s%3D&reserved=0> still doesn’t seem to be addressed, or am I misunderstanding?
Overall, I propose to accept the proposal, possibly requiring that the above point be addressed.
What do you all think?
Cheers, Manuel
_______________________________________________ ghc-steering-committee mailing list ghc-steering-committee@haskell.org mailto:ghc-steering-committee@haskell.org https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee
_______________________________________________ ghc-steering-committee mailing list ghc-steering-committee@haskell.org https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee

Let’s consolidate the discussion of Proposal #43 in this current thread about the revised proposal. And for reference, here is SimonPJ’s recent message posted in the old thread: SimonPJ’s message got support from Iavor and Richard, and SimonM previously expressed support on this Round 2 thread. In the meantime, the proposal has also been changed to use ’;’ as a separator (instead of the initially proposed ’|’). However, this still leaves us with https://github.com/ghc-proposals/ghc-proposals/pull/43#issuecomment-39808601... https://github.com/ghc-proposals/ghc-proposals/pull/43#issuecomment-39808601... where the proposal author writes that he will update the proposal with new typing rules along SimonPJ’s suggestions within a few weeks. Hence, it seems to me that we need to wait with a formal decision until that update of the typing rules has happened. Do you agree, Simon? In any case, is anybody unhappy with any aspect other than ”what would and would not typecheck” (which will hopefully be addressed in those forthcoming typing rules)? If so, please speak now. Cheers, Manuel
01.06.2018 17:30 Manuel M T Chakravarty
: We now have a revised version of the ”Or pattern” proposal #43 to consider:
(formatted) https://github.com/osa1/ghc-proposals/blob/or_patterns/proposals/0000-or- https://github.com/osa1/ghc-proposals/blob/or_patterns/proposals/0000-or-patterns.rst (PR thread) https://github.com/ghc-proposals/ghc-proposals/pull/43
You may remember that we discuss this a while back
https://mail.haskell.org/pipermail/ghc-steering-committee/2017-November/0002... https://mail.haskell.org/pipermail/ghc-steering-committee/2017-November/0002...
and finally decided to bounce it back to the authors with the following recommendation:
https://github.com/ghc-proposals/ghc-proposals/pull/43#issuecomment-35818932... https://github.com/ghc-proposals/ghc-proposals/pull/43#issuecomment-35818932...
We previously decided that we are inclined to accept this proposal if the authors change the points that we highlighted. Judging from the conversation of SimonPJ and Richard with the author on the GitHub thread, it appears to me that most of the issues have been addressed. However, Simon’s point
• "Patterns that bind existentials, dictionaries, or equalities are rejected by the type checker". I disagree. Earlier I suggested "no variable bound by an or-pattern can have a type that mentions an existential variable bound by the or-pattern". That is much more friendly because you can still match against an existential constructor; you just can’t bind an existential variable.
from <https://github.com/ghc-proposals/ghc-proposals/pull/43#issuecomment-36893340... https://github.com/ghc-proposals/ghc-proposals/pull/43#issuecomment-36893340...> still doesn’t seem to be addressed, or am I misunderstanding?
Overall, I propose to accept the proposal, possibly requiring that the above point be addressed.
What do you all think?
Cheers, Manuel

The Haskell report does some things, including typing rules, by giving the desugaring, and saying “the original typechecks if the deguared version does). As it happens that approach is a very nice, simple way to say what or-patterns should typecheck; it deals with all the issues of existentials and locally-captured dictionaries (by ruling them out) at one blow.
So I’d be content with a deguaring rule for or-patterns, along the lines I gave, saying that this governs the typing too. That should only take Omer a few minutes to add; indeed we could accept subject to that condition.
Simon
From: ghc-steering-committee
participants (4)
-
Manuel M T Chakravarty
-
Richard Eisenberg
-
Simon Marlow
-
Simon Peyton Jones