/** @module transduce.ts */
import { HKT, Type, URIS } from 'fp-ts/lib/HKT';
import { Applicative, EntryKey, EntryValue, Functor, Predicate } from './helper-types';
declare module 'fp-ts/lib/HKT' {
interface URI2HKT {
'babakness/transduce': Transduce;
'Array': A[];
}
}
export declare const mapPairValue: (fn: (a: VA) => VB) => ([k, v]: [K, VA]) => [K, VB];
export declare const mapPairKey: (fn: (a: KA) => KB) => ([k, v]: [KA, V]) => [KB, V];
export declare const filterPairValue: (fn: Predicate) => ([k, v]: [K, V]) => boolean;
export declare const filterPairKey: (fn: Predicate) => ([k, v]: [K, V]) => boolean;
export declare const mapping: (transform: any) => (reducing: any) => (acc: any, item: any) => any;
export declare const filtering: (predicate: (item: any) => boolean) => (reducing: any) => (acc: any, item: any) => any;
export declare const filterReducer: (predicate: (acc: any, item: any) => boolean) => (reducing: any) => (acc: any, item: any) => any;
export declare const reduceEntries: (acc: any, [k, v]: [any, any]) => {
[x: number]: any;
};
/**
* Idea: implement Either within transduce stream, ie, map become "right" and mapLeft, reduceLeft, etc, operate on Left. Swap could swap left and right
*/
export declare class Transduce {
readonly list: A[];
readonly xform: (reducing: any) => (acc: any, item: any) => any;
static readonly _URI: 'babakness/transduce';
static of(xs: B[]): Transduce;
static of(xs: B[]): Transduce;
static toPairs(xs: Record): Transduce;
static toPairs(xs: Record): Transduce;
private static spreadArgsCompose;
readonly _A: A;
readonly _URI: 'babakness/transduce';
constructor(list: A[], xform?: (reducing: any) => (acc: any, item: any) => any);
map(fn: (a: A) => B): Transduce;
mapPairKey, KB, V extends EntryValue>(fn: (a: KA) => KB): Transduce<[KB, V]>;
mapPairValue, VA extends EntryValue, VB>(fn: (a: VA) => VB): Transduce<[K, VB]>;
filterType(predicate: (a: A) => a is B): Transduce;
filter(predicate: (a: A) => boolean): Transduce;
filterPairKey>(predicate: (a: K) => boolean): Transduce;
filterPairKeyType, V extends EntryValue, KT extends K>(predicate: (a: K) => a is KT): Transduce<[KT, V]>;
filterPairValue>(predicate: (a: V) => boolean): Transduce;
filterPairValueType, V extends EntryValue, VT extends V>(predicate: (a: V) => a is VT): Transduce<[K, VT]>;
chain(fn: (a: A) => Transduce): Transduce;
ap(other: Transduce<(a: A) => B>): Transduce;
take(n: number): Transduce;
every(n: number, offset?: number): Transduce;
/**
* order switched for compatibility with fp-ts library
*/
fold(init: B, concat: (acc: B, item: A) => B): B;
reduce(concat: (acc: B, item: A) => B, init: B): B;
join(concat?: (acc: any, item: any) => any, init?: never[]): A[];
/**
* If the inner value is of form [K,V][] (see this `param` for details),
* then this method will reduce or fold the inner value into an object.
*/
joinFromPairs(this: Transduce, init?: {}): {
[k: string]: A extends [K, (infer U)] ? U : A;
};
traverseLegacy(this: Transduce>, of: (a: Transduce) => Type>, fn: (a: B) => C): Type>;
traverse(F: Applicative, fn: (a: A) => HKT & Functor): Type>;
sequenceLegacy(this: Transduce>, of: (a: Transduce) => Type>): Type>;
sequence(this: Transduce>, F: Applicative | never[] | B[]>): Type>;
traverse_(this: Transduce>, of: (a: Transduce) => Type>, fn: (a: Type) => HKT): Type>;
sequenceNonStandardFunctor(this: Transduce>, of: (a: Transduce) => Type>): Type>;
private compose;
}