morphisms-functors-0.1.4: Functors, theirs compositions and transformations

Safe HaskellSafe
LanguageHaskell2010

Control.Functor.Traversable

Synopsis

Documentation

class Covariant t => Traversable t where Source #

Let f :: (Applicative t, Applicative g) => t a -> u a
Let p :: (Pointable t, Pointable g) => t a -> u a
When providing a new instance, you should ensure it satisfies the four laws:
* Naturality of traversing: g . traverse f ≡ traverse (g . f)
* Naturality of sequencing: f . sequence = sequence . comap f
* Preserving point: p (point x) ≡ point x
* Preserving apply: f (x <*> y) ≡ f x <*> f y

Minimal complete definition

(->>)

Methods

(->>) :: (Pointable u, Applicative u) => t a -> (a -> u b) -> (u :.: t) b Source #

Infix version of traverse

traverse :: (Pointable u, Applicative u) => (a -> u b) -> t a -> (u :.: t) b Source #

Prefix version of ->>

sequence :: (Pointable u, Applicative u) => (t :.: u) a -> (u :.: t) a Source #

The dual of distribute

Instances
Traversable Identity Source # 
Instance details

Defined in Data.Functor.Identity

Methods

(->>) :: (Pointable u, Applicative u) => Identity a -> (a -> u b) -> (u :.: Identity) b Source #

traverse :: (Pointable u, Applicative u) => (a -> u b) -> Identity a -> (u :.: Identity) b Source #

sequence :: (Pointable u, Applicative u) => (Identity :.: u) a -> (u :.: Identity) a Source #

Traversable (Constant a :: * -> *) Source # 
Instance details

Defined in Data.Functor.Constant

Methods

(->>) :: (Pointable u, Applicative u) => Constant a a0 -> (a0 -> u b) -> (u :.: Constant a) b Source #

traverse :: (Pointable u, Applicative u) => (a0 -> u b) -> Constant a a0 -> (u :.: Constant a) b Source #

sequence :: (Pointable u, Applicative u) => (Constant a :.: u) a0 -> (u :.: Constant a) a0 Source #