semialign-1.2.0.1: Align and Zip type-classes from the common Semialign ancestor.

Safe Haskell | Trustworthy
Language | Haskell2010

Data.Crosswalk

Contents

- Crosswalk
- Bicrosswalk

Synopsis

- class (Functor t, Foldable t) => Crosswalk t where
  - crosswalk :: Align f => (a -> f b) -> t a -> f (t b)
  - sequenceL :: Align f => t (f a) -> f (t a)
- class (Bifunctor t, Bifoldable t) => Bicrosswalk t where
  - bicrosswalk :: Align f => (a -> f c) -> (b -> f d) -> t a b -> f (t c d)
  - bisequenceL :: Align f => t (f a) (f b) -> f (t a b)

# Crosswalk

class (Functor t, Foldable t) => Crosswalk t where #

Foldable functors supporting traversal through an alignable functor.

Minimal definition: `crosswalk` or `sequenceL`.

Laws:

    crosswalk (const nil) = const nil
    crosswalk f = sequenceL . fmap f

Minimal complete definition

crosswalk | sequenceL

Methods

crosswalk :: Align f => (a -> f b) -> t a -> f (t b) #

sequenceL :: Align f => t (f a) -> f (t a) #

#### Instances

Instances details

Crosswalk [] # |
Instance details Defined in Data.Crosswalk Methods crosswalk :: Align f => (a -> f b) -> [a] -> f [b] # sequenceL :: Align f => [f a] -> f [a] #
Crosswalk Maybe # |
Instance details Defined in Data.Crosswalk Methods crosswalk :: Align f => (a -> f b) -> Maybe a -> f (Maybe b) # sequenceL :: Align f => Maybe (f a) -> f (Maybe a) #
Crosswalk Identity # |
Instance details Defined in Data.Crosswalk Methods crosswalk :: Align f => (a -> f b) -> Identity a -> f (Identity b) # sequenceL :: Align f => Identity (f a) -> f (Identity a) #
Crosswalk Seq # |
Instance details Defined in Data.Crosswalk Methods crosswalk :: Align f => (a -> f b) -> Seq a -> f (Seq b) # sequenceL :: Align f => Seq (f a) -> f (Seq a) #
Crosswalk Vector # |
Instance details Defined in Data.Crosswalk Methods crosswalk :: Align f => (a -> f b) -> Vector a -> f (Vector b) # sequenceL :: Align f => Vector (f a) -> f (Vector a) #
Crosswalk ((,) a) # |
Instance details Defined in Data.Crosswalk Methods crosswalk :: Align f => (a0 -> f b) -> (a, a0) -> f (a, b) # sequenceL :: Align f => (a, f a0) -> f (a, a0) #
Crosswalk (These a) # |
Instance details Defined in Data.Crosswalk Methods crosswalk :: Align f => (a0 -> f b) -> These a a0 -> f (These a b) # sequenceL :: Align f => These a (f a0) -> f (These a a0) #
(Crosswalk f, Crosswalk g) => Crosswalk (Compose f g) # |
Instance details Defined in Data.Crosswalk Methods crosswalk :: Align f0 => (a -> f0 b) -> Compose f g a -> f0 (Compose f g b) # sequenceL :: Align f0 => Compose f g (f0 a) -> f0 (Compose f g a) #

# Bicrosswalk

class (Bifunctor t, Bifoldable t) => Bicrosswalk t where #

Bifoldable bifunctors supporting traversal through an alignable functor.

Minimal definition: `bicrosswalk` or `bisequenceL`.

Laws:

    bicrosswalk (const empty) (const empty) = const empty
    bicrosswalk f g = bisequenceL . bimap f g

Minimal complete definition

bicrosswalk | bisequenceL

Methods

bicrosswalk :: Align f => (a -> f c) -> (b -> f d) -> t a b -> f (t c d) #

bisequenceL :: Align f => t (f a) (f b) -> f (t a b) #

#### Instances

Instances details

Bicrosswalk Either # |
Instance details Defined in Data.Crosswalk Methods bicrosswalk :: Align f => (a -> f c) -> (b -> f d) -> Either a b -> f (Either c d) # bisequenceL :: Align f => Either (f a) (f b) -> f (Either a b) #
Bicrosswalk These # |
Instance details Defined in Data.Crosswalk Methods bicrosswalk :: Align f => (a -> f c) -> (b -> f d) -> These a b -> f (These c d) # bisequenceL :: Align f => These (f a) (f b) -> f (These a b) #