mirror of
https://github.com/github/semantic.git
synced 2024-12-23 06:41:45 +03:00
Add a Coalescent instance for Join over These.
This commit is contained in:
parent
f8678b6f8e
commit
11fc889883
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user