Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Data.Bitraversable.Compat
Synopsis
- module Data.Bitraversable
- firstA :: (Bitraversable t, Applicative f) => (a -> f c) -> t a b -> f (t c b)
- secondA :: (Bitraversable t, Applicative f) => (b -> f c) -> t a b -> f (t a c)
Documentation
module Data.Bitraversable
firstA :: (Bitraversable t, Applicative f) => (a -> f c) -> t a b -> f (t c b) #
Traverses only over the first argument.
firstA
f ≡bitraverse
fpure
secondA :: (Bitraversable t, Applicative f) => (b -> f c) -> t a b -> f (t a c) #
Traverses only over the second argument.
secondA
f ≡bitraverse
pure
f
Examples
Basic usage:
>>>
secondA (find odd) (Left [])
Just (Left [])
>>>
secondA (find odd) (Left [1, 2, 3])
Just (Left [1,2,3])
>>>
secondA (find odd) (Right [4, 5])
Just (Right 5)
>>>
secondA (find odd) ([1, 2, 3], [4, 5])
Just ([1,2,3],5)
>>>
secondA (find odd) ([1,2,3], [4])
Nothing
Since: base-4.21.0.0