1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 22:31:36 +03:00

🔥 bothOfThese.

This commit is contained in:
Rob Rix 2016-04-04 15:39:07 -04:00
parent a33acf8bdf
commit fd150be38e

View File

@ -16,10 +16,6 @@ type Both a = Join (,) a
both :: a -> a -> Both a both :: a -> a -> Both a
both = curry Join both = curry Join
-- | Construct Both with These values & defaults.
bothOfThese :: Both a -> These a a -> Both a
bothOfThese (Join a) = Join . uncurry fromThese a
-- | Construct Both (Maybe) with These values, defaulting to Nothing. -- | Construct Both (Maybe) with These values, defaulting to Nothing.
maybeBothOfThese :: These a a -> Both (Maybe a) maybeBothOfThese :: These a a -> Both (Maybe a)
maybeBothOfThese = Join . fromThese Nothing Nothing . bimap Just Just maybeBothOfThese = Join . fromThese Nothing Nothing . bimap Just Just