On Thu, Mar 8, 2012 at 6:09 AM, Henning Thielemann <lemming@henning-thielemann.de> 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'.

There was a discussion period on this about 6 months ago. We're just now finally getting it all integrated. I'd rather not add new names for the same operations.
 
These definitions are the most natural definition of the properties of their appropriate transformers, by defining the monad homomorphism from the simpler monad.

We might discuss, whether (Monad m) is too restrictive or whether it should be only (Functor m).

The problem with Functor m in this situation is it can lead to places due to our broken class hierarchy where the end user can't apply them. If we get the class hierarchy fixed, I'd be more than happy to revisit this along with the thousands of other compromises we have had forced on us. ;)

_______________________________________________
Libraries mailing list
Libraries@haskell.org
http://www.haskell.org/mailman/listinfo/libraries