
On 2 août 05, at 22:03, Paul Moore wrote:
I've started learning Haskell, and I'm going through all the tutorial material I can find - there's a lot of good stuff available.
One thing I haven't found a really good discussion of, is practical examples of building monads. There's plenty of discussion of the IO monad, and the state monad, and a lot of good theory on monads, but although I've seen tantalising statements about how powerful the ability to define your own monads can be, but no really concrete examples - something along the lines of
- here is problem X - this might be our first cut at coding it - we can abstract out this stuff, as a monad - see how the code looks now, how much cleaner it is
(I've seen this type of model developing a state monad, but I'm looking for a more application-specific approach).
have you read this http://homepages.inf.ed.ac.uk/wadler/papers/marktoberdorf/ marktoberdorf.pdf ? It presents a pb, show how it sux when coded naively without monad, and then show how beautiful the code is when you use a monad. I have also one time read an example where you use monads while implementing the unification or type inference algorithm, perhaps in the original monad paper (the essence of functional programming).