Dan Doel wrote:
On Tuesday 20 May 2008, [EMAIL PROTECTED] wrote:
Actually, it's true less than 50% of the time. In particular, it's
not true of any monad transformer.
Sure it is. Any particular transformer t typically comes with some particular
way of writing a function of type t m a -> m a (you may have to throw away
some t-related stuff, of course).
Since a specific transformed monad is built from a specific monad, and a
specific transformer, and specific transformers are likely to have a function
of type t m a -> m a, and specific monads are likely to have functions of
type m a -> a, you can compose them to get a function of type t m a -> a for
the specific monad t m. And so on for transformed-transformed monads. :)
That only fails if either of the specific pieces fails to have the right
function, which happens well under 50% of the time, I think (IO and STM are
the ones that immediately occur to me (barring a certain evil function),
although you could make a case for ST by technicality; no failing
transformers come to mind (except CCT if we're counting ST), but I haven't
wracked my brain very hard).
-- Dan
The claim was "less than 50% of the time", not "less than 50% of the
monads in the standard libraries". I wonder what fraction of monads in
real code the IO monad alone accounts for? 50% does not seem implausible
to me.
Dan Weston
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe