
21 Mar
2006
21 Mar
'06
3:54 p.m.
On Tue, Mar 21, 2006 at 10:38:06AM -0800, Iavor Diatchki wrote:
On 3/20/06, John Meacham
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. Andrew