1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 14:54:16 +03:00

🔥 bothOfThese.

This commit is contained in:
Rob Rix 2016-03-11 01:05:54 -05:00
parent 8be4e9bc83
commit 693f91b93c

View File

@ -12,10 +12,6 @@ newtype Both a = Both { runBoth :: (a, a) }
both :: a -> a -> Both a both :: a -> a -> Both a
both = curry Both both = curry Both
-- | Construct Both with These values & defaults.
bothOfThese :: Both a -> These a a -> Both a
bothOfThese a = these (`both` snd a) (both (fst a)) both
-- | Apply a function to `Both` sides of a computation. -- | Apply a function to `Both` sides of a computation.
runBothWith :: (a -> a -> b) -> Both a -> b runBothWith :: (a -> a -> b) -> Both a -> b
runBothWith f = uncurry f . runBoth runBothWith f = uncurry f . runBoth