Prototype of 'docase' notation

Tomas Petricek tomas.petricek at
Thu Aug 25 14:48:22 CEST 2011

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?) 


More information about the Glasgow-haskell-users mailing list