semialign-1.3.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 :: Type -> Type) 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 :: Type -> Type -> Type) 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 :: Type -> Type) where Source #

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) Source #

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

#### Instances

Instances details

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

# Bicrosswalk

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

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) Source #

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

#### Instances

Instances details

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