[Haskell-cafe] Replace data constructors via meta programming

Ryan Reich ryan.reich at gmail.com
Sun Feb 18 16:56:02 UTC 2018


Just to cheerlead Tom, as I have nothing to add but wouldn't want it to
seem like no one agreed, I also think this is a great idea. The objection
on the Reddit thread about dependent functions isn't prohibitive: both of
these features will be GHC extensions anyway. They can be exclusive.

On Feb 18, 2018 05:11, "Tom Ellis" <
tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> wrote:

>
> > -- Not valid Haskell!! Can't pattern match on constructor only...
> > magic = \case
> >     Var -> id
> >     Not -> not
> >     And -> (&&)
> >     Or -> (||)
> >     If -> (==>)
> >     Iff -> (==)
>
> This has often seemed to me to be a natural extension of case syntax.
> There
> is a short analysis in the following Reddit post:
>
>     https://www.reddit.com/r/haskell/comments/7s0ski/
> lambdacase_in_the_wild/dt1zzyy/
>
> I would be strongly in favour of adding an extension to do this (unless
> someone can find a reason that it couldn't work).
>
> Tom
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20180218/e63979f1/attachment.html>


More information about the Haskell-Cafe mailing list