[Haskell-cafe] monad subexpressions

Dan Licata drl at cs.cmu.edu
Thu Aug 2 17:53:13 EDT 2007

Hi Chris,

Simon mentioned this to me as a possible project when I started my
internship here at MSR, so I'm pretty sure this is both on the wish-list
and not already taken (but we should check with Simon to make sure).
I've since wished for it a few times as I've been implementing view
patterns, so I personally think it would be a great thing for you to

If you're interested in doing this, I'd be happy to give you an overview
of what pieces of GHC you'll need to touch and to answer your questions
(as best I can!) as you work on the implementation.  I've gotten to know
the front end of GHC a little over the past few weeks.  

Let me know,

On Aug02, Chris Smith wrote:
> 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
> Thoughts?

More information about the Haskell-Cafe mailing list