different flavours of Monad Template Library
g9ks157k at acme.softbase.org
Mon Jan 12 10:17:11 EST 2009
it’s already problematic, that State, StateT etc. are under Control.Monad.
While they are monads, they are also applicative functors, for example. And
some “monad transformers” are also applicative functor transformers and
probably all of them are functor transformers. There are situations where
you want to use these types only as applicative functors, for example when
composing context-free parsers.
Since they are all functors at least, it might be sensible to put them under
Control.Functor. Or it might be a good idea to put them under Data in the
module hierarchy. That way, a compatibility package could provide the old
interface under Control.Monad and new stuff would be situated under
Control.Functor or Data.
During this restructuring, we could also rename State to StateTrans since
values of State are not states but state transformers. There are similar
problems with Cont since values of Cont type are not continuations but
functions from continuations to results. It’s problematic when you deal with
states and state transformers or continuations and Cont values. How do you
name your local variables? I’d like to say “state” for a state but it would
also be sensible to say “state” for a value of type State, i.e., a state
More information about the Libraries