
Hi all, On a number of occasions I found myself declaring simple instances like instance Monoid a => Monoid (State s a) where mzero = return mzero mappend = liftM2 mappend that make my life considerably easier. Would it be a good idea to add such instances to the Monad Transformer Library? Of course, one could ask where to stop---but for me it make sense to always add sensible instances of the classes from base to a given library. Cheers, Stefan

On Mon, 6 Jul 2009, Stefan Holdermans wrote:
Hi all,
On a number of occasions I found myself declaring simple instances like
instance Monoid a => Monoid (State s a) where mzero = return mzero mappend = liftM2 mappend
that make my life considerably easier. Would it be a good idea to add such instances to the Monad Transformer Library?
... and to 'transformers'. However, in 'transformers' we had to define it for StateT, since (State s) is a synonym for (StateT s Identity). But I think this is a good idea anyway. I also need this instance occasionally and had written a custom data type for this purpose: http://hackage.haskell.org/packages/archive/monoid-transformer/0.0.1/doc/htm... Since it does only need Applicative functionality it can be defined for all other types in MTL.
participants (2)
-
Henning Thielemann
-
Stefan Holdermans