projects
/
ghc-base.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0f7f842
)
add instances
author
Ross Paterson
<ross@soi.city.ac.uk>
Mon, 24 Apr 2006 10:21:46 +0000
(10:21 +0000)
committer
Ross Paterson
<ross@soi.city.ac.uk>
Mon, 24 Apr 2006 10:21:46 +0000
(10:21 +0000)
Data/Monoid.hs
patch
|
blob
|
history
diff --git
a/Data/Monoid.hs
b/Data/Monoid.hs
index
cba6993
..
8a30b73
100644
(file)
--- a/
Data/Monoid.hs
+++ b/
Data/Monoid.hs
@@
-111,6
+111,7
@@
instance Monoid (Endo a) where
-- | Boolean monoid under conjunction.
newtype All = All { getAll :: Bool }
-- | Boolean monoid under conjunction.
newtype All = All { getAll :: Bool }
+ deriving (Eq, Ord, Read, Show, Bounded)
instance Monoid All where
mempty = All True
instance Monoid All where
mempty = All True
@@
-118,6
+119,7
@@
instance Monoid All where
-- | Boolean monoid under disjunction.
newtype Any = Any { getAny :: Bool }
-- | Boolean monoid under disjunction.
newtype Any = Any { getAny :: Bool }
+ deriving (Eq, Ord, Read, Show, Bounded)
instance Monoid Any where
mempty = Any False
instance Monoid Any where
mempty = Any False
@@
-125,6
+127,7
@@
instance Monoid Any where
-- | Monoid under addition.
newtype Sum a = Sum { getSum :: a }
-- | Monoid under addition.
newtype Sum a = Sum { getSum :: a }
+ deriving (Eq, Ord, Read, Show, Bounded)
instance Num a => Monoid (Sum a) where
mempty = Sum 0
instance Num a => Monoid (Sum a) where
mempty = Sum 0
@@
-132,6
+135,7
@@
instance Num a => Monoid (Sum a) where
-- | Monoid under multiplication.
newtype Product a = Product { getProduct :: a }
-- | Monoid under multiplication.
newtype Product a = Product { getProduct :: a }
+ deriving (Eq, Ord, Read, Show, Bounded)
instance Num a => Monoid (Product a) where
mempty = Product 1
instance Num a => Monoid (Product a) where
mempty = Product 1