Skip to content
This repository was archived by the owner on Jun 21, 2022. It is now read-only.

Conversation

@quchen
Copy link
Contributor

@quchen quchen commented Jul 23, 2016

@strake
Copy link

strake commented Aug 15, 2016

I propose we merge this RFC as is. Any dissenters?

@gbaz
Copy link

gbaz commented Aug 15, 2016

So to make clear: if the proposal is merged, this moves from a discussion on whether the proposal should be added to the haskell report, to a phase where an actually delta against the haskell report is produced?

It seems according to the process the next step is for a Shepard to ensure that a discussion among prime committee members can reach a consensus here. (I personally think the proposal lgtm but I'm not on the prime committee so that doesn't count for much :-) ).

@goldfirere
Copy link

Drawback: You can't use \case to make an anonymous function with more than one argument.

That said, I still support inclusion in Haskell Prime.

@quchen
Copy link
Contributor Author

quchen commented Aug 18, 2016

@gbaz Probably yes, but I think if the discussion is lively and altogether in favour of the proposal, we don’t need to appoint a shepherd to guide through it. The shepherd is mostly for preventing the discussion from stalling or going off-topic too much, I would say.

@gbaz
Copy link

gbaz commented Aug 23, 2016

Sure. But what if the discussion is muted, but in favor? It still needs
someone to just "take it to the finish line" as it were (and e.g. volunteer
to draft the delta to the report or ensure that someone else does). If you
or M Farkas-Dyck want to take this on, that sound great to me :-).

On Thu, Aug 18, 2016 at 2:59 PM, David Luposchainsky <
notifications@github.com> wrote:

@gbaz https://github.com/gbaz Probably yes, but I think if the
discussion is lively and altogether in favour of the proposal, we don’t
need to appoint a shepherd to guide through it. The shepherd is mostly for
preventing the discussion from stalling or going off-topic too much, I
would say.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#3 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABEt2ZE8b2TCAywbXsfkTvdaqoY1vzqeks5qhKuTgaJpZM4JTUrf
.

@quchen
Copy link
Contributor Author

quchen commented Aug 26, 2016

@gbaz On second thought, maybe it’s not so bad if we try out the shepherd thing on a smaller issue.

@quchen quchen self-assigned this Aug 26, 2016


#########
Drawbacks
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A drawback which comes to mind, actually, is the inability to match multiple arguments with this syntax. I think we ought to note this in the RFC.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And now as i re-read this thread i see @goldfirere already brought this up, derp.

Anyhow, thanks for noting in RFC.

@quchen
Copy link
Contributor Author

quchen commented Sep 22, 2016

Added a note about the multiple argument shortcoming.

@yav
Copy link

yav commented Oct 4, 2016

People have suggested that a much more natural notation for LambdaCase is:

 case of { P1 -> e1; P2 -> e2 }

Thus LambdaCase may be explained simply as a "case section". Seems much nicer than the current syntax.

@strake
Copy link

strake commented Oct 5, 2016

@yav I agree it is nicer.

@spl
Copy link

spl commented Oct 5, 2016

Can you change the link in the opening comment to the final rendered proposal instead of the initial commit? That will help anybody (like me) coming late to the conversation.
https://github.com/quchen/rfcs/blob/lambdacase/texts/0000-lambdacase.rst

@spl
Copy link

spl commented Oct 5, 2016

In general, I think the drawbacks should be given more appreciation and exemplified and not given short shrift.

In particular, the paragraph starting with ”feature-wise, it is worth noting that lambda case does not support lambdas with multiple arguments well” says two things to me:

  1. “Oh, by the way, there's this very minor issue that you don't need to worry about.” In other words, this paragraph is passing a judgment. I think one should make the statement, give an example, and leave the reader to judge the merits.
  2. I'm not sure what it means to “support lambdas with multiple arguments well.” The “well” suggests the question “to what degree does it support lambdas with multiple arguments?” If the answer is that there is no degree – it either supports them or doesn't – then I think the “well” should be removed.

@blamario
Copy link
Contributor

blamario commented Nov 1, 2016

I have personally never used this extension, so I'm not sure if I should comment at all, but my impression is that it it's less mature than most of the others. The single-argument-only complaint has come up only recently, and I wouldn't be surprised if a superior alternative becomes available in a couple of years.

@jwiegley
Copy link

jwiegley commented Nov 1, 2016

I use this extension fairly regularly, but I know there are many people who would prefer it in a different form. So, I agree it needs more research.

@JLimperg
Copy link

FYI, Agda uses the following syntaxes (the second having been introduced recently) for pattern matching lambdas:

toy toy' : Bool

toy = λ { zero (suc _)  true
        ; _    _        false
        }

toy' = λ where
         zero (suc _)  true
         _    _        false

These support multiple arguments, but in exchange, one has to put parens around constructors with arguments (even in the case where the lambda only takes one argument, which thus becomes slightly more cumbersome). Thus, the LHS of each case mirrors exactly the LHS of a top-level function definition.

@augustss
Copy link

augustss commented Jan 18, 2017 via email

@andreasabel
Copy link
Member

After years of being supported by GHC, \case cannot be modified anymore. Too late for discussion on how it should have looked like instead.

If I need a binary anonymous pattern matching function, I write

f = uncurry $ \case
  (Cons x y, Foo z) -> bar
  ...

Writing tuples isn't super nice, but it isn't much longer than having to parenthesize each pattern, like in:

f = \cases
  (Cons x y) (Foo z) -> bar

I think adding \case to the standard is a no brainer now.

@jwiegley
Copy link

Having used this extension quite... extensively now, I realize that \case calls out to my mind that a lambda is being defined better than case of. For example:

forM_ xs $ \case
   ...

vs.

forM_ xs $ case of
  ...

Given how often the former is \i -> before being changed to \case, it shows its kinship with other lambdas a little better to the scanning eye.

@nhn1966
Copy link

nhn1966 commented May 28, 2020 via email

@yav
Copy link

yav commented May 28, 2020

I am with @nhn1966 on this one---I do quite a bit of Haskell development on a daily basis and I never use \case or find the need for it.

@quchen quchen removed their assignment Apr 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.