import { Monoid, MonoidConstructor } from "./monoid"; import { Applicative, ApplicativeDictionary } from "./applicative"; import { Monad } from "./monad"; import { Maybe } from "./maybe"; import { Either } from "./either"; export interface Foldable { foldr(f: (a: A, acc: B) => B, acc: B): B; foldl(f: (acc: B, a: A) => B, init: B): B; shortFoldr(f: (a: A, acc: B) => Either, acc: B): B; shortFoldl(f: (acc: B, a: A) => Either, acc: B): B; size(): number; maximum(): number; minimum(): number; sum(): number; } export declare type AnyFoldable = Foldable | A[]; export declare abstract class AbstractFoldable implements Foldable { abstract foldr(f: (a: A, acc: B) => B, init: B): B; foldl(f: (acc: B, a: A) => B, init: B): B; shortFoldr(f: (a: A, b: B) => Either, acc: B): B; shortFoldl(f: (b: B, a: A) => Either, acc: B): B; size(): number; maximum(): number; minimum(): number; sum(): number; } export declare function foldable(constructor: Function): void; export declare function foldMap>(f: MonoidConstructor, a: Foldable | A[]): M; export declare function foldr(f: (a: A, b: B) => B, init: B, a: Foldable | A[]): B; export declare function foldl(f: (acc: B, a: A) => B, init: B, a: Foldable | A[]): B; export declare function size(a: Foldable | any[]): number; export declare function isEmpty(a: AnyFoldable): boolean; export declare function take(n: number, t: Foldable): A[]; export declare function find(f: (a: A) => boolean, t: Foldable): Maybe; export declare function findLast(f: (a: A) => boolean, t: Foldable): Maybe; export declare function findIndex(f: (a: A) => boolean, t: Foldable): Maybe; export declare function findLastIndex(f: (a: A) => boolean, t: Foldable): Maybe; export declare function shortFoldl(f: (b: B, a: A) => Either, acc: B, l: Foldable): B; export declare function all(pred: (a: A) => boolean, foldable: Foldable): boolean; export declare function any(pred: (a: A) => boolean, foldable: Foldable): boolean; export declare function toArray(t: Foldable | A[]): A[]; export declare function sequence_(d: ApplicativeDictionary | ArrayConstructor, t: Foldable> | Array>): any; export declare function foldrM(f: (a: A, b: B) => Monad, mb: Monad, t: Foldable | A[]): Monad; export declare function maximum(t: Foldable): number; export declare function minimum(t: Foldable): number; export declare function sum(t: Foldable): number;