[Haskell-cafe] Let's teach GHC idiom brackets!

Edward Kmett ekmett at gmail.com
Wed Feb 18 21:32:04 UTC 2015


On Wed, Feb 18, 2015 at 4:15 PM, Tikhon Jelvis <tikhon at jelv.is> wrote:
>
> That said, I tried using SHE's idiom brackets in some of my own existing
> code and was a bit underwhelmed. They're certainly an improvement for
> simpler cases, especially ones using operators, but fall apart quickly for
> more complex expressions.
>

My experience with them is pretty close to Tikhon's here, so I'm pretty
much neutral on whether we go ahead and do this. Idiom brackets seem to
have some strident supporters, I just have never personally had a case
where I worked through what the idiom bracket version was and found the
result appreciably clearer. When you need to mix in joins and regular
application it gets quite messy.

-Edward


-tikhon
>
> On Wed, Feb 18, 2015 at 12:20 PM, Elliot Cameron <
> elliot.cameron at covenanteyes.com> wrote:
>
>> As a beginner Haskeller, I think my perspective might be surprising: I
>> actually think idiom brackets would make learning and understanding Haskell
>> *easier* for new-comers. Applicative code is intimidating to read for
>> beginners and I have often been afraid to use it because it all seems so
>> magical (lots of strange operators between everything!). But when I read
>> the papers and saw idiom brackets, I suddenly realized that the whole idea
>> was actually pretty simple! I've been pushing for them ever since.
>>
>> ------------------------------
>> *From: *"Oliver Charles" <ollie at ocharles.org.uk>
>> *To: *"Haskell Cafe" <haskell-cafe at haskell.org>
>> *Sent: *Wednesday, February 18, 2015 2:46:16 PM
>> *Subject: *[Haskell-cafe] Let's teach GHC idiom brackets!
>>
>>
>> Hi friends,
>>
>> Last night I was having a good natter with Chris Done, and the topic of
>> idiom brackets came up. Specifically, Chris' hindent and
>> structured-haskell-mode tools have both recently become aware of the
>> quasiquoter in applicative-quoters
>> <http://hackage.haskell.org/package/applicative-quoters> - allowing one
>> to write ordinary Haskell code but have it formatted/edited as if it wasn't
>> even inside a quasiquoter. However, it's a shame that Chris has to now be
>> aware of this specific quasiquoter just to get his tools to work properly.
>> Furthermore, it's a shame that *everyone* has to do the same whenever
>> they want to manipulate Haskell code.
>>
>> That said, idiom brackets - at least to me - appears to be a very
>> desirable syntax extension. A recent desire for this came to me while
>> working with reactive-banana. As almost everything "interesting" is even an
>> Event or a Behavior, there tends to be a lot of assembling programs with
>> applicative syntax. Another obvious example is when using parser
>> combinators.
>>
>> Therefore, I'd like to propose that we teach GHC about this desugaring,
>> properly.
>>
>> Now, how we do that, and in fact, what I'm even proposing... that's all
>> up for discussion! I spoke briefly with David Christiansen and a few others
>> in the Idris IRC channel last night about their particular variation of
>> idiom brackets, and it seems people are generally happy with that. Copying
>> that almost verbatim is probably the first proposal I'd put forward.
>>
>> This is the first time I've proposed an extension to GHC, so I'll need
>> some guidance to make this happen - both in terms of guiding the discussion
>> through to a proposal, but ultimately implementing it. Perhaps the proposal
>> will be ready for ZuriHac, and some GHC devs could help me work on it there.
>>
>> Anyway, that's enough rambling from me. I would love to hear your
>> thoughts - do you think idiom brackets are a good idea? Do you have a
>> particular tricky case that you think they need to support? I'm all ears.
>>
>> -- Ollie
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>>
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>>
>>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150218/1c5f61b7/attachment.html>


More information about the Haskell-Cafe mailing list