1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 06:41:45 +03:00

Add a both function.

This commit is contained in:
Rob Rix 2016-02-29 01:31:04 -05:00
parent 7f73085dd5
commit 391d102dcf

View File

@ -3,6 +3,9 @@ module Data.Functor.Both where
newtype Both a = Both { runBoth :: (a, a) }
deriving (Eq, Show, Functor, Foldable, Traversable)
both :: a -> a -> Both a
both = curry Both
instance Applicative Both where
pure a = Both (a, a)
Both (f, g) <*> Both (a, b) = Both (f a, g b)