std.foldable

Modules

Implementation of the Foldable type

Types

type Foldable f = {
    foldr : forall a b . (a -> b -> b) -> b -> f a -> b,
    foldl : forall a b . (b -> a -> b) -> b -> f a -> b
}

Operations over a data structure that can be folded which means that a functions gets called on each element to reduce the structure to a single value (Array, List and Map are all Foldable)

Values

let foldr ?fold : forall f .
    forall a b .
    [std.foldable.Foldable f] -> (a -> b -> b) -> b -> f a -> b

let foldl ?fold : forall f .
    forall a b .
    [std.foldable.Foldable f] -> (b -> a -> b) -> b -> f a -> b

let fold_m ?fold ?monad f z : forall b a m t .
    [std.foldable.Foldable t]
        -> [std.monad.Monad m]
        -> (a -> b -> m a)
        -> a
        -> t b
        -> m a

let concat monoid : forall m t . [std.foldable.Foldable t] -> std.monoid.Monoid m -> t m -> m

let concat_map monoid f : forall a m t .
    [std.foldable.Foldable t] -> std.monoid.Monoid m -> (a -> m) -> t a -> m

let find ?fold pred : forall a t .
    [std.foldable.Foldable t]
        -> (a -> std.types.Bool)
        -> t a
        -> std.types.Option a

let find_map ?fold pred : forall b a t .
    [std.foldable.Foldable t]
        -> (a -> std.types.Option b)
        -> t a
        -> std.types.Option b

let all pred : forall a t .
    [std.foldable.Foldable t] -> (a -> std.types.Bool) -> t a -> std.types.Bool

let any pred : forall a t .
    [std.foldable.Foldable t] -> (a -> std.types.Bool) -> t a -> std.types.Bool

let elem x : forall a t .
    [std.foldable.Foldable t] -> [std.cmp.Eq a] -> a -> t a -> std.types.Bool

let count : forall a t . [std.foldable.Foldable t] -> t a -> Int