on master help sign in
Make Identity an instance of Semigroup/Monoid (for Semigroup/Monoid types).

#4635

commit82238dc289c566fde60634a066664d5ed8c27724 authorAndreas Ländle <andreas.laendle@de.bosch.com> dateTue 8 Jan 2019, 07:32 (8 years ago) parentf445c51
1 file changed+6
libs/base/Control/Monad/Identity.idr+6
libs/base/Control/Monad/Identity.idr+6
@@ -29,3 +29,9 @@ Enum a => Enum (Identity a) where
2929 toNat (Id x) = toNat x
3030 fromNat n = Id $ fromNat n
3131 pred (Id n) = Id $ pred n
32+
33+(Semigroup a) => Semigroup (Identity a) where
34+ (<+>) x y = Id (runIdentity x <+> runIdentity y)
35+
36+(Monoid a) => Monoid (Identity a) where
37+ neutral = Id (neutral)