Re: Add instance Monoid ((f :+: g) a)
Ah, sorry. (:+:) is not an Applicative. It's still possible to make instance Monoid: instance Semigroup (f a) => Semigroup ((f :+: g) a) where InL x <> InL y = InL (x <> y) InL _ <> y = y x <> _ = x instance Monoid (f a) => Monoid ((f :+: g) a) where mempty = InL mempty
---------- Forwarded message --------- 보낸사람: Dannyu NDos <ndospark320@gmail.com> Date: 2019년 8월 7일 (수) 04:50 Subject: Re: Add instance Monoid ((f :+: g) a) To: Haskell Libraries <libraries@haskell.org> Ah, sorry. (:+:) is not an Applicative. It's still possible to make instance Monoid: instance Semigroup (f a) => Semigroup ((f :+: g) a) where InL x <> InL y = InL (x <> y) InL _ <> y = y x <> _ = x instance Monoid (f a) => Monoid ((f :+: g) a) where mempty = InL mempty
participants (1)
-
Dannyu NDos