Refactoring Semigroup/Monoid (was: instance Applicative Data.Map)

Henning Thielemann lemming at
Tue Nov 20 00:26:17 CET 2012

On Sat, 17 Nov 2012, Edward Kmett wrote:

> Honestly, the main issue is that even if you have the ability to describe default definitions for how to
> implement superclasses, it isn't really all that useful. :(
> e.g. Every monad transformer still needs each of its instances crafted by hand. This even applies to
> simpler types:
> Given
> instance (Traversable f, Traversable g) => Traversable (Compose f g)
> you don't want the derived instances for Functor and Foldable, 
> instance (Traversable f, Traversable g) => Functor (Compose f g)
> instance (Traversable f, Traversable g) => Foldable (Compose f g)
> you want the more permissive ones you can roll by hand.
> instance (Functor f, Functor g) => Functor (Compose f g)
> instance (Functor f, Functor g) => Foldable (Compose f g)

Good example. Frequently I think that we should replace all these type 
class instance extensions by a generic way to program instances.

More information about the Libraries mailing list