[Haskell-cafe] Idiom Brackets for GHC (first full proposal)

Roman Cheplyaka roma at ro-che.info
Fri Feb 27 10:09:27 UTC 2015


On 27/02/15 09:58, Oliver Charles wrote:
> So you would argue that these should desugar to the same thing?

I guess I'm talking more generally here. On the one hand, I find this
practical and convenient. On the other hand, it (almost by design)
breaks our usual intuition of how the space works.

E.g. in most other cases  id x  is the same as  x, but inside idiom
brackets they mean x and pure x, respectively.

I don't have a specific suggestion, just a concern.


> I'm on
> the fence - on the one hand its nice to be able to leave a few 'pure's
> out, but on the other those parenthesis have no syntactic meaning
> before, so it's questionable why they suddenly do inside idiom brackets.
> 
> I can live with needing a few more 'pure's though.
> 
> - Ollie
> 
> On 26 Feb 2015 23:28, "Roman Cheplyaka" <roma at ro-che.info
> <mailto:roma at ro-che.info>> wrote:
> 
>     I'm starting to like this. Except the weird difference between spaces on
>     different levels that you point out, i.e.
> 
>     [| const True False |]
> 
>     vs
> 
>     [| (const True) False |]
> 
> 
> 
> 
>     On 26/02/15 23:04, Oliver Charles wrote:
>     > Hi all,
>     >
>     > A few days ago I made a post here to gauge interest in adding idiom
>     > brackets to GHC. Response was a bit more mixed than I was hoping,
>     but no
>     > one seemed to drastically against the idea, so I've moved forward
>     with a
>     > more detailed proposal.
>     >
>     > You can find the full proposal here:
>     >
>     >     https://ocharles.org.uk/IdiomBrackets.html
>     >
>     > A particular difference in my proposal from existing solutions comes
>     > from my desire to lift almost *all* expressions - with the original
>     > syntax - into idiom brackets. This means normal function
>     application and
>     > tuples, but also case expressions, let bindings, record construction,
>     > record update, infix notation, and so on.
>     >
>     > At first I was skeptical about this, but I am finding uses for
>     this more
>     > and more. I really like how it lets me use the interesting data (that
>     > is, whatever is "under" the applicative functor) where it's most
>     > relevant - rather than having to build a function and thread that
>     value
>     > back through. Examples of this can be seen in my proposal.
>     >
>     > To prove its use, I've been working with this Template Haskell
>     > expression:
>     >
>     >     https://ocharles.org.uk/IdiomExp.hs
>     >
>     > It *almost* does exactly what I want, the only problem is I can't get
>     > Template Haskell to give me a difference between
>     >
>     >     $(i [| const True False |])
>     >
>     > and
>     >
>     >     $(i [| (const True) False |])
>     >
>     > which I was planning to be significant.
>     >
>     > The proposal has mostly grown into my own personal notebook, so I'm
>     > happy to clarify anything that is vague/contradictory/confusing.
>     >
>     > Look forward to hearing your thoughts!
>     >
>     > -- Ollie
>     > _______________________________________________
>     > Haskell-Cafe mailing list
>     > Haskell-Cafe at haskell.org <mailto:Haskell-Cafe at haskell.org>
>     > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>     >
> 



More information about the Haskell-Cafe mailing list