From 5e32c041fbe3530867ed46cca350a976e3bc89dd Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 8 Mar 2016 10:24:20 -0500 Subject: [PATCH] :fire: the PartialSemigroup/coalesceBy stuff for Both. --- src/Data/Functor/Both.hs | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/Data/Functor/Both.hs b/src/Data/Functor/Both.hs index 9918c89de..94cb8f8be 100644 --- a/src/Data/Functor/Both.hs +++ b/src/Data/Functor/Both.hs @@ -1,6 +1,5 @@ module Data.Functor.Both where -import Data.Adjoined import Data.Bifunctor import Prelude hiding (zipWith, fst, snd) import qualified Prelude @@ -53,13 +52,3 @@ instance Applicative Both where instance Monoid a => Monoid (Both a) where mempty = pure mempty mappend a b = mappend <$> a <*> b - -instance (PartialSemigroup a, Monoid a) => PartialSemigroup (Both a) where - coalesce = coalesceBy (pure coalesce) - -coalesceBy :: Monoid a => Both (Coalesce a) -> Both a -> Both a -> Maybe (Both a) -coalesceBy coalesce a b = case coalesce <*> a <*> b of - Both (Just l, Just r) -> Just (both l r) - Both (Nothing, Just r) -> Just (both (fst a `mappend` fst b) r) - Both (Just l, Nothing) -> Just (both l (snd a `mappend` snd b)) - Both (Nothing, Nothing) -> Nothing