From e33014ef272bd85c85e8b5b88d3f0747783265d1 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Sun, 28 Feb 2016 21:18:03 -0500 Subject: [PATCH] Add a Monoid instance for Join. --- src/Data/Bifunctor/Join.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Data/Bifunctor/Join.hs b/src/Data/Bifunctor/Join.hs index 0623fad19..c6ec74967 100644 --- a/src/Data/Bifunctor/Join.hs +++ b/src/Data/Bifunctor/Join.hs @@ -6,3 +6,7 @@ newtype Join a = Join { runJoin :: (a, a) } instance Applicative Join where pure a = Join (a, a) Join (f, g) <*> Join (a, b) = Join (f a, g b) + +instance Monoid a => Monoid (Join a) where + mempty = pure mempty + mappend a b = pure mappend <*> a <*> b