Prototype of 'docase' notation

Sebastian Fischer fischer at
Fri Aug 26 13:26:56 CEST 2011

This is interesting.

I think using a slightly different notation would avoid confusion with
matching on tuples. Why not just write

    docase a,b,c of

instead of

    docase (a,b,c) of



On Thu, Aug 25, 2011 at 9:48 PM, Tomas Petricek
<tomas.petricek at> wrote:
> Hello,!
> at the Cambridge Hackathon, I started implementing an extension for GHC that
> adds the 'docase' notation. The notation is a syntactic sugar that can makes
> it easier to write code that works with monads that have three additional
> operations (parallel composition, choice and aliasing). Such monads include
> various moands for parallel and concurrent programming (Par monad, CPH and
> Orc) as well as other monads such as parsers.
> The proposal is in details discussed in our Haskell Symposium paper:
> (the page also contains
> link to earlier pre-processor based prototype with a couple of more
> examples). I created a GHC Trac ticket to track the discussion about the
> feature: A prototype
> version of the GHC extension is available here:
> I'd love to hear some feedback about the feature and the extension:
> * Do you think this is a useful extension and do you know about any monads
> that could benefit from it?
> * What is the best syntax for the feature? (The notation intentionally
> resembles 'case' pattern matching, but there are some differences)
> * The feature adds some aspects of recently added monad comprehensions using
> do-style syntax, but both 'docase' and monad comprehensions have features
> that cannot be written using the other. Is that a good desing, or should
> there be a closer correspondence?
> * Can anybody review the prototype implementation? (I believe it is a
> reasonably modular change, so it should not affect the rest of the language,
> but is there anything missing/incorrect?)
> Thanks!
> Tomas
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at

More information about the Glasgow-haskell-users mailing list