Proposal: Add missing Monoid for ZipList

M Farkas-Dyck strake888 at gmail.com
Sun Jul 26 03:43:41 UTC 2015


On 26/07/2015 at 12:23:13 +0900, Fumiaki Kinoshita wrote:
> There is another possible instance:
> 
> instance Semigroup a => Monoid (ZipList a) where
>   mempty = ZipList []
>   mappend (ZipList xs0) (ZipList ys0) = ZipList (mappend xs0 ys0) where
>     go (x:xs) (y:ys) = x <> y : go xs ys
>     go xs [] = xs
>     go [] ys = ys

This breaks the identity law.


More information about the Libraries mailing list