Module

Data.Semigroup.Traversable

#Traversable1

class Traversable1 :: (Type -> Type) -> Constraintclass (Foldable1 t, Traversable t) <= Traversable1 t  where

Traversable1 represents data structures with a minimum of one element that can be traversed, accumulating results and effects in some Applicative functor.

  • traverse1 runs an action for every element in a data structure, and accumulates the results.
  • sequence1 runs the actions contained in a data structure, and accumulates the results.

The traverse1 and sequence1 functions should be compatible in the following sense:

  • traverse1 f xs = sequence1 (f <$> xs)
  • sequence1 = traverse1 identity

Traversable1 instances should also be compatible with the corresponding Foldable1 instances, in the following sense:

  • foldMap1 f = runConst <<< traverse1 (Const <<< f)

Default implementations are provided by the following functions:

  • traverse1Default
  • sequence1Default

Members

Instances

#traverse1Default

traverse1Default :: forall t a b m. Traversable1 t => Apply m => (a -> m b) -> t a -> m (t b)

A default implementation of traverse1 using sequence1.

#sequence1Default

sequence1Default :: forall t a m. Traversable1 t => Apply m => t (m a) -> m (t a)

A default implementation of sequence1 using traverse1.

Modules