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

Oliver Charles ollie at ocharles.org.uk
Thu Feb 26 21:04:03 UTC 2015


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


More information about the Haskell-Cafe mailing list