[Haskell-cafe] one-way monads

Lennart Augustsson lennart at augustsson.net
Wed May 21 19:08:44 EDT 2008

I certainly don't use 50% IO monads.  I regard any use of the IO monad
except at the top level as a failure. :)

On Wed, May 21, 2008 at 7:14 PM, Dan Weston <westondan at imageworks.com> wrote:
> Dan Doel wrote:
>> On Tuesday 20 May 2008, ajb at spamcop.net 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
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list