Re: Monoid for ZipList

박신환 ndospark320 at naver.com
Thu May 3 23:40:44 UTC 2018


I aim to make the semantic consistent compared to that of other type classes (here Maybe).
 
Also note that your instance is identical to upcoming Ap, as Ap (ZipList a). I also aim to make Monoids as diverse as possible. 
 
 
-----Original Message-----
From: "Andrew Martin"<andrew.thaddeus at gmail.com>
To: "박신환"<ndospark320 at naver.com>;
Cc: "Haskell Libraries"<libraries at haskell.org>;
Sent: 2018-05-03 (목) 21:05:24
Subject: Re: Monoid for ZipList
 
There is another possible instance. We can instead write:
 
    instance Semigroup a => Semigroup (ZipList a) where
      (<>) = liftA2 (<>)
    instance Monoid a => Monoid (ZipList a) where
      mempty = pure mempty
 
This behaves differently, and it is also law-abiding.
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20180504/fb8458c5/attachment.html>


More information about the Libraries mailing list