| 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) Source #
Traverses only over the first argument.
firstAf ≡bitraversefpure
secondA :: Bitraversable t => Applicative f => (b -> f c) -> t a b -> f (t a c) Source #
Traverses only over the second argument.
secondAf ≡bitraversepuref
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: 4.21.0.0