<div dir="ltr"><div><div><div>You can play around with idiom brackets now using the Strathclyde Haskell Enhancement (SHE)[1]. It's pretty easy to configure and will give you a good feel for how the feature behaves in practice. I haven't used Idris, and the syntax looks a bit different[2], but I suspect they're pretty similar in capability. If not, I'd love to see how they differ in detail.<br><br></div>Personally, I'm definitely in favor of idiom brackets or similar syntax abstractly. 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. Now, I might have been using them incorrectly, but I found it awkward to express code that used both normal *and* Applicative application at the same time... which proved to be about half of all my code using Applicative operators. Common cases like `f <$> g x <*> h y` are a bit tricky, and they completely hose the $ operator. <br><br></div>Now, I didn't spend much time or effort trying to make idiom brackets work, so I'm certainly not saying that they're unworkable. A good start for the proposal would be to examine more complex cases and idioms present in real code and how idiom brackets would—or wouldn't—improve them. Idris likely has some more interesting examples to start from, but there are probably enough differences in both the language and common idioms to make specific Haskell examples necessary. Adding idiom brackets to some of your own code, or code from some open source projects, would be a good way to both find relevant examples and refine the whole proposal.<br><br></div>-tikhon<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 18, 2015 at 12:20 PM, Elliot Cameron <span dir="ltr"><<a href="mailto:elliot.cameron@covenanteyes.com" target="_blank">elliot.cameron@covenanteyes.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:trebuchet ms,sans-serif;font-size:12pt;color:#000000">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.<br><br><hr><div style="color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt"><b>From: </b>"Oliver Charles" <<a href="mailto:ollie@ocharles.org.uk" target="_blank">ollie@ocharles.org.uk</a>><br><b>To: </b>"Haskell Cafe" <<a href="mailto:haskell-cafe@haskell.org" target="_blank">haskell-cafe@haskell.org</a>><br><b>Sent: </b>Wednesday, February 18, 2015 2:46:16 PM<br><b>Subject: </b>[Haskell-cafe] Let's teach GHC idiom brackets!<div><div class="h5"><br><br><div dir="ltr">Hi friends,<div><br></div><div>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 <a href="http://hackage.haskell.org/package/applicative-quoters" target="_blank">applicative-quoters</a> - 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 <i>everyone</i> has to do the same whenever they want to manipulate Haskell code.</div><div><br></div><div>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.</div><div><br></div><div>Therefore, I'd like to propose that we teach GHC about this desugaring, properly.</div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>-- Ollie</div><h2 dir="ltr" style="margin:0px 0px 10px;color:rgb(136,153,166);font-size:14px;font-weight:400;line-height:1;max-width:100%;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;display:inline-block!important;direction:ltr!important;background-color:rgb(245,248,250)"></h2></div>
<br></div></div>_______________________________________________<br>Haskell-Cafe mailing list<br><a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br><a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br></div><br></div></div><br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br></div>