mirror of
https://github.com/github/semantic.git
synced 2024-12-25 16:02:43 +03:00
🔥 Data.Coalescent.
This commit is contained in:
parent
e4e3418a7a
commit
b036fa27a3
@ -20,7 +20,6 @@ library
|
|||||||
, Control.Monad.Free
|
, Control.Monad.Free
|
||||||
, Data.Align
|
, Data.Align
|
||||||
, Data.Bifunctor.These
|
, Data.Bifunctor.These
|
||||||
, Data.Coalescent
|
|
||||||
, Data.Copointed
|
, Data.Copointed
|
||||||
, Data.Functor.Both
|
, Data.Functor.Both
|
||||||
, Data.Option
|
, Data.Option
|
||||||
|
@ -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)
|
|
Loading…
Reference in New Issue
Block a user