Andrew Coppin wrote:
Janis Voigtlaender wrote:
http://wwwtcs.inf.tu-dresden.de/~voigt/mpc08.pdf
"It is well-known that trees with substitution form a monad."
...OK, I just learned something new. Hanging around Haskell Cafe can
be so illuminating! :-)
Now, if only I could actually comprehend the rest of the paper... o_O
I'll probably regret this for the rest of my life, but...
As best as I can tell, a monad is essentially a container of some kind,
together with a function that puts stuff into a container, and another
function that maps over the container and combines the results in some
way. That would rather suggest that *any* container type is potentially
a monad of some kind. [Although possibly not a *useful* one...]
Since a tree is a kind of container, yes, it should be a monad. [I'm
still not really sure whether it's "useful".]
Presumably a set monad would work something like the list monad. One
could imagine an array monad [although counting the size of the result
set before allocating the array would seem rather expensive]. Perhaps a
dictionary could be a monad? I'm not precisely sure how that would work.
Hmm, what other kinds of random containers could you make a monad out
of? [And would you bother?]
On the other hand, Maybe is a rather odd kind of container, but a very
useful monad...
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe