[Haskell-cafe] extending Do notation

Tillmann Rendel rendel at informatik.uni-marburg.de
Tue May 20 17:37:17 UTC 2014


silvio wrote:
> I'm not en expert in formality but it should work something like this
>   stmtpart1 { exp } stmtpart2
> should desugar to
>   x <- exp
>   stmtpart1 x stmtpart2
> but as I said I don't insist on this working in the let case.

Oh, I think this would work fine with let, if you do it as follows:

   let x = stmtpart1 { exp } stmtpart2
   more stuff x other things

desugars to

   let x = do temp <- exp
              stmtpart1 temp stmtpart2
   more stuff x other things

This is just your desugaring from above, but inside the body of the let.

But what about lambdas:

   stmtpart1 (\x -> {exp}) stmtpart2

And what about nested braces:

   stmtpart1 { something { more } whatever } stmtpart2

There are lots of other cases to consider :)

silvio wrote about idiom brackets:
> Yes I know I looked it up and it was very complicated. I didn't
> understand everything.

Is your proposal more or less complicated? It seems less complicated at 
first, but if you fill in all the details and work out all the different 
cases, maybe it ends up being more complicated.


More information about the Haskell-Cafe mailing list