Proposal: Add missing Monoid for ZipList

Henning Thielemann lemming at henning-thielemann.de
Sat Jul 25 20:57:46 UTC 2015



On Sat, 25 Jul 2015, Christopher Allen wrote:

> http://hackage.haskell.org/package/base-4.8.1.0/docs/Control-Applicative.html#t:ZipList
> 
> There's a Monoid that matches what the Applicative for ZipList does that seems to be missing.
> 
> instance Monoid a => Monoid (ZipList a) where
>   mempty  = pure mempty
>   mappend = liftA2 mappend
> 
> It's been brought up before:
> 
> https://mail.haskell.org/pipermail/haskell-cafe/2009-October/067861.html
> 
> Not only is it useful when it's the Monoid you want, but it serves an 
> educational purpose for highlighting the relationship between Monoid and 
> Applicative as well.
> 
> Are there any good reasons not to have it?

The Monoid instance for lists is not related to Applicative list instance 
- so why should the instances for ZipList? We could as well use the Monoid 
list implementation for ZipLists. If there is no actual application for 
the instance I would leave it unimplemented.


More information about the Libraries mailing list