
On Thu, Mar 08, 2012 at 11:09:35AM +0000, Henning Thielemann wrote:
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'.
But this means they would have different types from StateT :: (s -> m (a, s)) -> StateT s m a ReaderT :: (r -> m a) -> ReaderT r m a WriterT :: m (a, w) -> WriterT w m a