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:
parent
7f73085dd5
commit
391d102dcf
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user