Merge pull request #4636 from alaendle/feature/identity-monoid
Make Identity an instance of Semigroup/Monoid
commita6a51cd0ccf719bd8edf65016059f437d9f2d128
authorNiklas Larsson <metaniklas@gmail.com>
dateWed 27 Feb 2019, 01:05 (8 years ago)
parent22f69e882238dc
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)