tilia-0.2.0.0: corpora/vendored/cpp/declaration/infix-method-with-its-operator-in-each-branch.hs
{-# LANGUAGE CPP #-}
-- An operator written in each branch, between operands written once around
-- the conditional, takes the operand after it into each branch, where the
-- same question asked above picks the instance the method belongs to.
module Weather.Rainfall (Rainfall (..)) where
data Rainfall = Rainfall !Int !Int
instance Monoid Rainfall where
mempty = Rainfall 0 0
#ifdef WITH_SEMIGROUP
instance Semigroup Rainfall where
#endif
(Rainfall am pm)
#ifdef WITH_SEMIGROUP
<>
#else
`mappend`
#endif
(Rainfall am' pm') = Rainfall (am + am') (max pm pm')