[ghc-steering-committee] Proposal #302: `\of` (New Shepherd: Simon PJ)

Vladislav Zavialov (int-index) vlad.z.4096 at gmail.com
Mon Jun 28 10:19:33 UTC 2021


There’s major flaw in options (1) and (4). Consider:

\cases
  X a ->
    -- very long
    -- rhs
    -- that takes
    -- several lines
  Y b -> …

By the time I get to the `Y b -> …` alternative, I may have forgotten if it’s \case or \cases, so I won’t know whether to (mentally) parse it as two patterns `Y` `b`, or a single pattern `Y b`.

Option (2) solves this with commas:

\cases
  X, a -> ...
  Y, b -> …

Option (3) solves this with a lambda:

case of
  \X a -> …
  \Y b -> …

So in both (2) and (3) there’s a clear syntactic indication that parsing this alternative differs from normal, unary \case and case of.

Unfortunately, Simon discarded both of these from the vote! So I’m currently leaning towards rejecting the proposal, since I can’t vote for the options that look reasonable to me.

- Vlad
  

> On 28 Jun 2021, at 12:44, Simon Peyton Jones via ghc-steering-committee <ghc-steering-committee at haskell.org> wrote:
> 
> Dear Steering Committee 
> 
> Two weeks ago I asked
> 
> 	• Are there any other alternatives you strongly want on the ballot?
>  
> 
> I got these responses
> 
> 	• Joachim, Simon, Alejandro, Arnaud: nothing to add
> 	• Vitaly, Eric, Tom, Richard, Vlad: no response
> I’d love to hear from the five of you, please.  I want to get a decision on this, and I can’t do that if I don’t hear from you.
> 
> Thanks
> 
> Simon
> 
>  
> 
> From: ghc-steering-committee <ghc-steering-committee-bounces at haskell.org> On Behalf Of Simon Peyton Jones via ghc-steering-committee
> Sent: 15 June 2021 13:52
> To: Joachim Breitner <mail at joachim-breitner.de>; ghc-steering-committee at haskell.org
> Subject: Re: [ghc-steering-committee] Proposal #302: `\of` (New Shepherd: Simon PJ)
>  
> 
> |  I’d like to reassing shepherding of this one.
> |  
> |  It seems to be clear that we want “something like this”, there are many ways
> |  to skin the cat, so it comes down to opinion and what we need is a decision
> |  (or a call to votes). As with anything that’s possibly quite opinionated,
> |  it’s good to have an authorative voice, so in this case, Simon PJ.
> |  
> |  Simon, can you either come up with a “all things considered, I think this
> |  variant is the (narrowly) the best” recommendation or, alternative, a
> |  “please vote on the following options” verdict?
>  
> OK, to remind everyone
> 	• Here is the proposal: https://github.com/JakobBruenker/ghc-proposals/blob/patch-1/proposals/0000-lambda-layout.md
> 	• Here is the discussion: https://github.com/ghc-proposals/ghc-proposals/pull/302
>  
> The basic idea is to extend to lambda all the facilities that you get with function definitions, especially multiple patterns and guards.   This seems clearly a good idea, whose only obstacle is syntactic.  There are no conceptual or specification challenges.  The only point at issue is that of concrete syntax.
>  
> The proposal offers four possible syntactic options.  After reviewing, I propose to discard (2) and (3) leaving these alternatives
>  
> 	• Option (1)    \cases { p1 p2 -> rhs1; q1 q2 -> rhs2 }
> 		• Lives alongside \case, but allows multiple patterns
> 		• Other keywords are possible, but I think it must be a variant on \case
> 	• Option (4)   Same, but use \case as the keyword
> 		• Incompatible with existing \case => extended transition period, unhappy users
> 		• \case { (Just x) -> rhs1; Nothing -> rhs2 } will require parens forever, which in the common case of a one argument lambda see clunky.
> 	• Option (X).  Reject the proposal.
>  
> 
> Personally I favour (1).   I’m relaxed about having multiple ways of saying the thing (think of let vs where), and I see no harm provided the two constructs look and behave the same.   I’ve decided I like \cases precisely because it’s the plural of \case, which is exactly what is going on.
> 
> I think we’ll end up having to vote on this, which is fine when it’s a judgement call about syntax.   But first:
> 
> 	• Are there any other alternatives you strongly want on the ballot?
> I say “strongly” because I don’t want to open up a big new debate… we at the stage of trying to narrow options.
> 
> Thanks
> 
> Simon
> 
> _______________________________________________
> ghc-steering-committee mailing list
> ghc-steering-committee at haskell.org
> https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee



More information about the ghc-steering-committee mailing list