blob: cb7180af1cc21a8c9a9708599d9d0468cac415ba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
module Identity where
import Data.Semigroup
import Test.QuickCheck
newtype Identity a = Identity a deriving (Show, Eq)
instance Semigroup a => Semigroup (Identity a) where
(Identity x) <> (Identity y) = Identity (x <> y)
instance Monoid a => Monoid (Identity a) where
mempty = Identity mempty
mappend (Identity x) (Identity y) = Identity $ mappend x y
instance Arbitrary a => Arbitrary (Identity a) where
arbitrary = fmap Identity arbitrary
|