Module

Data.Semigroup.Foldable

Package
purescript-foldable-traversable
Repository
purescript/purescript-foldable-traversable

#Foldable1 Source

class (Foldable t) <= Foldable1 t  where

Foldable1 represents data structures with a minimum of one element that can be folded.

  • fold1 folds a structure using a Semigroup instance
  • foldMap1 folds a structure by accumulating values in a Semigroup

Default implementations are provided by the following functions:

  • fold1Default
  • foldMap1Default

Note: some combinations of the default implementations are unsafe to use together - causing a non-terminating mutually recursive cycle. These combinations are documented per function.

Members

Instances

#traverse1_ Source

traverse1_ :: forall b a f t. Foldable1 t => Apply f => (a -> f b) -> t a -> f Unit

Traverse a data structure, performing some effects encoded by an Apply instance at each value, ignoring the final result.

#for1_ Source

for1_ :: forall b a f t. Foldable1 t => Apply f => t a -> (a -> f b) -> f Unit

A version of traverse1_ with its arguments flipped.

This can be useful when running an action written using do notation for every element in a data structure:

#sequence1_ Source

sequence1_ :: forall a f t. Foldable1 t => Apply f => t (f a) -> f Unit

Perform all of the effects in some data structure in the order given by the Foldable1 instance, ignoring the final result.

#foldMap1Default Source

foldMap1Default :: forall a m t. Foldable1 t => Functor t => Semigroup m => (a -> m) -> t a -> m

A default implementation of foldMap1 using fold1.

#fold1Default Source

fold1Default :: forall m t. Foldable1 t => Semigroup m => t m -> m

A default implementation of fold1 using foldMap1.

#intercalate Source

intercalate :: forall m f. Foldable1 f => Semigroup m => m -> f m -> m

Fold a data structure using a Semigroup instance, combining adjacent elements using the specified separator.

#intercalateMap Source

intercalateMap :: forall a m f. Foldable1 f => Semigroup m => m -> (a -> m) -> f a -> m

Fold a data structure, accumulating values in some Semigroup, combining adjacent elements using the specified separator.

#maximum Source

maximum :: forall a f. Ord a => Foldable1 f => f a -> a

#minimum Source

minimum :: forall a f. Ord a => Foldable1 f => f a -> a