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

Add runLeft/runRight conveniences.

This commit is contained in:
Rob Rix 2016-02-29 09:33:38 -05:00
parent acd19b4502
commit acca5d8917

View File

@ -10,6 +10,14 @@ newtype Both a = Both { runBoth :: (a, a) }
both :: a -> a -> Both a
both = curry Both
-- | Runs the left side of a `Both`.
runLeft :: Both a -> a
runLeft = fst . runBoth
-- | Runs the right side of a `Both`.
runRight :: Both a -> a
runRight = snd . runBoth
zip :: Both [a] -> [Both a]
zip = zipWith both