1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 23:42:31 +03:00

🔥 Data.Coalescent.

This commit is contained in:
Rob Rix 2016-04-14 21:59:25 -04:00
parent e4e3418a7a
commit b036fa27a3
2 changed files with 0 additions and 14 deletions

View File

@ -20,7 +20,6 @@ library
, Control.Monad.Free
, Data.Align
, Data.Bifunctor.These
, Data.Coalescent
, Data.Copointed
, Data.Functor.Both
, Data.Option

View File

@ -1,13 +0,0 @@
module Data.Coalescent where
import Control.Applicative
import Data.Align
import Data.Functor.Identity
-- | The class of types which can optionally be coalesced together.
class Coalescent a where
-- | Returns the result of coalescing the operands together in an Alternative context. If they cannot be coalesced, they should each be produced individually.
coalesce :: (Align f, Alternative f) => a -> a -> f a
instance Coalescent a => Coalescent (Identity a) where
a `coalesce` b = sequenceA (coalesce <$> a <*> b)