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

Add runBothWith.

This commit is contained in:
Rob Rix 2016-02-29 19:41:05 -05:00
parent 7548e148dc
commit 51ad3ba049

View File

@ -11,6 +11,10 @@ newtype Both a = Both { runBoth :: (a, a) }
both :: a -> a -> Both a
both = curry Both
-- | Apply a function to `Both` sides of a computation.
runBothWith :: (a -> a -> b) -> Both a -> b
runBothWith f = uncurry f . runBoth
-- | Runs the left side of a `Both`.
fst :: Both a -> a
fst = Prelude.fst . runBoth