base-compat-0.14.1: A compatibility layer for base
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Bitraversable.Compat

Synopsis

Documentation

class (Bifunctor t, Bifoldable t) => Bitraversable (t :: Type -> Type -> Type) where #

Methods

bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> t a b -> f (t c d) #

Instances

Instances details
Bitraversable Arg 
Instance details

Defined in Data.Semigroup

Methods

bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> Arg a b -> f (Arg c d) #

Bitraversable Either 
Instance details

Defined in Data.Bitraversable

Methods

bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> Either a b -> f (Either c d) #

Bitraversable (,) 
Instance details

Defined in Data.Bitraversable

Methods

bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> (a, b) -> f (c, d) #

Bitraversable (Const :: Type -> Type -> Type) 
Instance details

Defined in Data.Bitraversable

Methods

bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> Const a b -> f (Const c d) #

Bitraversable ((,,) x) 
Instance details

Defined in Data.Bitraversable

Methods

bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> (x, a, b) -> f (x, c, d) #

Bitraversable (K1 i :: Type -> Type -> Type) 
Instance details

Defined in Data.Bitraversable

Methods

bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> K1 i a b -> f (K1 i c d) #

Bitraversable ((,,,) x y) 
Instance details

Defined in Data.Bitraversable

Methods

bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> (x, y, a, b) -> f (x, y, c, d) #

Bitraversable ((,,,,) x y z) 
Instance details

Defined in Data.Bitraversable

Methods

bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> (x, y, z, a, b) -> f (x, y, z, c, d) #

Bitraversable ((,,,,,) x y z w) 
Instance details

Defined in Data.Bitraversable

Methods

bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> (x, y, z, w, a, b) -> f (x, y, z, w, c, d) #

Bitraversable ((,,,,,,) x y z w v) 
Instance details

Defined in Data.Bitraversable

Methods

bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> (x, y, z, w, v, a, b) -> f (x, y, z, w, v, c, d) #

bifoldMapDefault :: (Bitraversable t, Monoid m) => (a -> m) -> (b -> m) -> t a b -> m #

bifor :: (Bitraversable t, Applicative f) => t a b -> (a -> f c) -> (b -> f d) -> f (t c d) #

biforM :: (Bitraversable t, Applicative f) => t a b -> (a -> f c) -> (b -> f d) -> f (t c d) #

bimapAccumL :: Bitraversable t => (a -> b -> (a, c)) -> (a -> d -> (a, e)) -> a -> t b d -> (a, t c e) #

bimapAccumR :: Bitraversable t => (a -> b -> (a, c)) -> (a -> d -> (a, e)) -> a -> t b d -> (a, t c e) #

bimapDefault :: Bitraversable t => (a -> b) -> (c -> d) -> t a c -> t b d #

bimapM :: (Bitraversable t, Applicative f) => (a -> f c) -> (b -> f d) -> t a b -> f (t c d) #

bisequence :: (Bitraversable t, Applicative f) => t (f a) (f b) -> f (t a b) #

bisequenceA :: (Bitraversable t, Applicative f) => t (f a) (f b) -> f (t a b) #

firstA :: (Bitraversable t, Applicative f) => (a -> f c) -> t a b -> f (t c b) Source #

Traverses only over the first argument.

firstA f ≡ bitraverse f pure

secondA :: (Bitraversable t, Applicative f) => (b -> f c) -> t a b -> f (t a c) Source #

Traverses only over the second argument.

secondA f ≡ bitraverse pure f

Examples

Expand

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