[Haskell] ANN: monadLib 2.0

Andrew Pimlott andrew at pimlott.net
Tue Mar 21 15:54:29 EST 2006

On Tue, Mar 21, 2006 at 10:38:06AM -0800, Iavor Diatchki wrote:
> On 3/20/06, John Meacham <john at repetae.net> wrote:
> > also, it looks like some of the very useful utility routines in the
> > current mtl such as 'asks' arn't included.
> I didn't add 'asks' because to me it seems redundant.

I would like it if all mtl classes had a function that captures the
general operation of the monad.  In this sense, asks is the essence of
the Reader monad.  The essense of the State monad, which I have defined
for myself many times, is

    state :: MonadState s m => (s -> (a, s)) -> m a

And so on for the others.  These could be part of the class (my
preference, because the other ops can have default implementations in
terms of it) or auxiliary functions.


More information about the Libraries mailing list