[Haskell-cafe] monad subexpressions

Chris Smith cdsmith at twu.net
Thu Aug 2 15:39:36 EDT 2007

I've heard Simon (Peyton-Jones) twice now mention the desire to be able 
to embed a monadic subexpression into a monad.  That would be 
http://article.gmane.org/gmane.comp.lang.haskell.prime/2267 and in the 
recent OSCON video.  Is someone working on implementing this?

If no,  I'll take a crack at it.
If yes, I'd be slower than someone else, since I'm new to GHC.

This seems like something a tad easier than type system extensions and 
the like since it's just desugaring... but a little harder than my 
"remove the GHCi banner" patch!  In other words, a perfect step for me.  
Also, I got so frustrated that I ended up abandoning some code recently 
because STM is, in the end, so darn hard to use as a result of this 
issue.  I'd love to see this solved, and I'm quite eager to do it.

Proposals for syntax I've seen include:

    $( expr   )   -- conflicts with template haskell
    ( <- expr )   -- makes sense, and I think it's unambiguous

Other ideas:

    ``expr``      -- back-ticks make sense for UNIX shell scripters
    (| expr |)    -- I don't think anything uses this yet


Chris Smith

More information about the Haskell-Cafe mailing list