Data.Semigroup.Foldable
- Package
- purescript-foldable-traversable
- Repository
- purescript/purescript-foldable-traversable
#Foldable1 Source
class Foldable1 :: (Type -> Type) -> Constraint
class (Foldable t) <= Foldable1 t where
Foldable1
represents data structures with a minimum of one element that can be folded.
foldr1
folds a structure from the rightfoldl1
folds a structure from the leftfoldMap1
folds a structure by accumulating values in aSemigroup
Default implementations are provided by the following functions:
foldr1Default
foldl1Default
foldMap1DefaultR
foldMap1DefaultL
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
foldr1 :: forall a. (a -> a -> a) -> t a -> a
foldl1 :: forall a. (a -> a -> a) -> t a -> a
foldMap1 :: forall a m. Semigroup m => (a -> m) -> t a -> m
Instances
#traverse1_ Source
traverse1_ :: forall t f a b. 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.
#sequence1_ Source
sequence1_ :: forall t f a. 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.
#foldr1Default Source
foldr1Default :: forall t a. Foldable1 t => (a -> a -> a) -> t a -> a
A default implementation of foldr1
using foldMap1
.
Note: when defining a Foldable1
instance, this function is unsafe to use
in combination with foldMap1DefaultR
.
#foldl1Default Source
foldl1Default :: forall t a. Foldable1 t => (a -> a -> a) -> t a -> a
A default implementation of foldl1
using foldMap1
.
Note: when defining a Foldable1
instance, this function is unsafe to use
in combination with foldMap1DefaultL
.
#foldMap1DefaultR Source
foldMap1DefaultR :: forall t m a. Foldable1 t => Functor t => Semigroup m => (a -> m) -> t a -> m
A default implementation of foldMap1
using foldr1
.
Note: when defining a Foldable1
instance, this function is unsafe to use
in combination with foldr1Default
.
#foldMap1DefaultL Source
foldMap1DefaultL :: forall t m a. Foldable1 t => Functor t => Semigroup m => (a -> m) -> t a -> m
A default implementation of foldMap1
using foldl1
.
Note: when defining a Foldable1
instance, this function is unsafe to use
in combination with foldl1Default
.
#intercalate Source
intercalate :: forall f m. 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 f m a. 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.