std.foldable

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 a a0 a1 .
    [std.foldable.Foldable a] -> (a0 -> a1 -> a1) -> a1 -> a a0 -> a1

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

let fold_m ?fold ?monad f z : forall a a0 a1 a2 .
    [std.foldable.Foldable a]
        -> [std.monad.Monad a0]
        -> (a1 -> a2 -> a0 a1)
        -> a1
        -> a a2
        -> a0 a1

let concat monoid : forall a a0 . [std.foldable.Foldable a] -> std.monoid.Monoid a0 -> a a0 -> a0

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

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

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

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

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

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

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