1
1
mirror of https://github.com/github/semantic.git synced 2024-11-25 02:58:36 +03:00

MaybeBoth is Coalescent.

This commit is contained in:
Rob Rix 2016-03-11 16:49:29 -05:00
parent f8afe6208a
commit 8b51fe7771

View File

@ -2,6 +2,7 @@
module Data.Functor.Both where
import Data.Align
import Data.Coalescent
import Data.Bifunctor
import Data.Bifunctor.These
import Prelude hiding (zipWith, fst, snd)
@ -57,3 +58,6 @@ instance Applicative MaybeBoth where
instance Crosswalk MaybeBoth where
crosswalk f (MaybeBoth ab) = runBothWith (alignWith (MaybeBoth . maybeBothOfThese)) (maybe nil f <$> ab)
instance Coalescent a => Coalescent (MaybeBoth a) where
coalesce as bs = sequenceL (coalesce <$> as <*> bs)