From 11fc889883389e8a3f220a4797c3c4410c0c2a19 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Mon, 14 Mar 2016 20:19:44 -0400 Subject: [PATCH] Add a Coalescent instance for Join over These. --- src/Data/Coalescent.hs | 7 +++++++ 1 file changed, 7 insertions(+) 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)