Drastic Prelude changes imminent

Henning Thielemann lemming at henning-thielemann.de
Wed Feb 11 22:14:50 UTC 2015



On Wed, 11 Feb 2015, Gabriel Gonzalez wrote:

> Actually, I don't consider this instance a hack.  One of the things that 
> convinced me of the elegance of this `Writer`-like instance for tuples is 
> that you can use it to implement another instance:
>
>    instance (Monoid a, Monoid b) => Monoid (a, b) where
>        mempty = pure mempty
>        mappend = liftA2 mappend

Funny, but without the Writer instance the implementation would be only 
slightly longer and it would be more comprehensible and more symmetric. If 
it would not be the Monoid instance you could not use 'pure' and 'liftA2' 
anyway.


More information about the Libraries mailing list