[Haskell-cafe] Alternative name for return

Tikhon Jelvis tikhon at jelv.is
Thu Aug 15 19:34:24 CEST 2013


If we're adding applicative brackets, it would be nice to have something
like ⦇⦈ as options via UnicodeSyntax. When playing around with She, I found
it much easier to read than the ASCII version, especially when I needed to
combine them:

    (|(|a + b|) + (|c * d|)|)
    ⦇⦇a + b⦈ + ⦇c * d⦈⦈

Coincidentally, She is the perfect way to experiment with idiom brackets
while thinking about a patch like this. I found it very illustrative just
to go through old code and see what could really be improved and what
couldn't. For me personally, I certainly found *some* code became more
readable, but not quite as much as I expected.


On Thu, Aug 15, 2013 at 10:44 AM, Anton Nikishaev <me at lelf.lu> wrote:

> Simon Peyton-Jones <simonpj at microsoft.com> writes:
>
> > |  Indeed, I wished the 0-ary case would be more alike to the unary
> > |  and binary case, cf.
> > |
> > |     return f0
> > |     f1 <$> a1
> > |     f2 <$> a1 <*> a2
> > |
> > |  What is needed is a nice syntax for "idiom brackets".
> >
> > Indeed.  I'm quite open to adding idiom brackets to GHC, if everyone
> > can agree on their syntax, and someone would like to offer a patch.
> >
> > Something like
> >       (| f a1 a2 |)
> > perhaps?
>
> I can make a patch after people agree on everything.
>
> There's also http://hackage.haskell.org/package/applicative-quoters with
> its template haskell nastiness
>
> h> :m +Control.Applicative.QQ.Idiom
> h> :set -XQuasiQuotes
> h> [i| (,) "THX" "BYE" |]
>
> [('T','B'),('T','Y'),('T','E'),('H','B'),('H','Y'),('H','E'),('X','B'),('X','Y'),('X','E')]
>
>
>
> --
> lelf
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130815/0f20f4c1/attachment.htm>


More information about the Haskell-Cafe mailing list