How can I use the following data type for a Monoid instance of it?
data Counts = Counts {
binds :: Int,
returns :: Int,
gets :: Int,
puts :: Int
} deriving (Eq, Show)
E.g. I figured something like:
mempty = Counts { 0, 0, 0, 0 }
(Counts { b, r, g, p }) mappend (Counts { b', r', g', p' }) = Counts { (b + b'), (r + r'), (g + g'), (p + p') }
But that gives me a parse error on '0'... Maybe I'm doing it totally wrong and misunderstanding the data type / monoid, but I cannot figure it out. If anyone could help me out it'd be much appreciated!
Best regards, Skyfe.