
8 Mar
2012
8 Mar
'12
6:09 a.m.
On Thu, 8 Mar 2012, Ross Paterson wrote:
* generalized constructor functions:
state :: Monad m => (s -> (a, s)) -> StateT s m a reader :: Monad m => (r -> a) -> ReaderT r m a writer :: Monad m => (a, w) -> WriterT w m a
I'd prefer to call them stateT, readerT, writerT in order to keep 'state', 'reader', 'writer' with the restricted types. The restricted type should work without type annotations in cases where I really only want type 'State'. Actually stateT, readerT, writerT are only alternative constructors for StateT, ReaderT, WriterT with a restriction on 'm'. We might discuss, whether (Monad m) is too restrictive or whether it should be only (Functor m).