
On 14 December 2011 20:21, Gregory Crosswhite
On Dec 14, 2011, at 4:40 PM, Ivan Lazar Miljenovic wrote:
[...] Apart from some
basic combinators in Control.Monad or the definitions of monad transformers, how much of what you write in do-blocks is applicable to some generic Monad instance as opposed to a specific Monad?
Well, if my *only* constraint on a type is that it be an instance of Monad, then *all* of the code written in do-blocks will be applicable to a generic Monad instance. That's the whole point. :-)
Furthermore, you make it sound like this generic case scenario is incredibly rare, but in fact it is very common: it occurs whenever someone writes a monadic transformer, which happens all the time. Imagine what writing monadic transformers would be like if you couldn't always trust that, say, (>>=) was a well-defined operation?
What I was trying to reference was times when I use the list monad as a pseudo-prolog, or the Maybe monad as a "stop when failed" case, etc.: trying to use one for the other doesn't always work. -- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com IvanMiljenovic.wordpress.com