diff --git a/src/Data/Coalescent.hs b/src/Data/Coalescent.hs index df1c423fc..5e26a8c01 100644 --- a/src/Data/Coalescent.hs +++ b/src/Data/Coalescent.hs @@ -1,6 +1,10 @@ +{-# LANGUAGE FlexibleInstances #-} module Data.Coalescent where import Control.Applicative +import Data.Align +import Data.Bifunctor.Join +import Data.Bifunctor.These import Data.Functor.Identity -- | The class of types which can optionally be coalesced together. @@ -13,3 +17,6 @@ instance Coalescent a => Coalescent (Identity a) where instance Coalescent a => Coalescent (Maybe a) where a `coalesce` b = sequenceA (coalesce <$> a <*> b) + +instance Coalescent a => Coalescent (Join These a) where + a `coalesce` b = sequenceA (coalesce <$> a <*> b)