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@gmail.com>
To: "박신환"<ndospark320@naver.com>;
Cc: "Haskell Libraries"<libraries@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.