UNPKG

7.53 kBTypeScriptView Raw
1import * as L from "./index";
2import { List } from "./index";
3export { Node, List, list, isList, length, of, empty, first, head, last, flatten, pop, init, tail, from, toArray, reverse, backwards, sort, group, dropRepeats, isEmpty } from "./index";
4export interface Curried2<A, B, R> {
5 (a: A): (b: B) => R;
6 (a: A, b: B): R;
7}
8export interface Curried3<A, B, C, R> {
9 (a: A, b: B, c: C): R;
10 (a: A, b: B): (c: C) => R;
11 (a: A): Curried2<B, C, R>;
12}
13export declare const prepend: typeof L.prepend & (<A>(value: A) => (l: List<A>) => List<A>);
14export declare const append: typeof prepend;
15export declare const pair: typeof L.pair & (<A>(first: A) => (second: A) => List<A>);
16export declare const repeat: typeof L.repeat & (<A>(value: A) => (times: number) => List<A>);
17export declare const times: typeof L.times & (<A>(func: (index: number) => A) => (times: number) => List<A>);
18export declare const nth: typeof L.nth & ((index: number) => <A>(l: List<A>) => A | undefined);
19export declare const map: typeof L.map & (<A, B>(f: (a: A) => B) => (l: List<A>) => List<B>);
20export declare const forEach: typeof L.forEach & (<A>(callback: (a: A) => void) => (l: List<A>) => void);
21export declare const pluck: typeof L.pluck & (<K extends string>(key: K) => <C, B extends K & (keyof C)>(l: List<C>) => List<C[B]>);
22export declare const intersperse: typeof prepend;
23export declare const range: typeof L.range & ((start: number) => (end: number) => List<number>);
24export declare const filter: typeof L.filter & (<A, B extends A>(predicate: (a: A) => a is B) => (l: List<A>) => List<B>) & (<A>(predicate: (a: A) => boolean) => (l: List<A>) => List<A>);
25export declare const reject: typeof filter;
26export declare const partition: typeof L.partition & (<A>(predicate: (a: A) => boolean) => (l: List<A>) => [List<A>, List<A>]);
27export declare const join: typeof L.join & ((seperator: string) => (l: List<string>) => List<string>);
28export declare const ap: typeof L.ap & (<A, B>(listF: List<(a: A) => B>) => (l: List<A>) => List<B>);
29export declare const flatMap: typeof L.flatMap & (<A, B>(f: (a: A) => List<B>) => (l: List<A>) => List<B>);
30export declare const chain: typeof L.flatMap & (<A, B>(f: (a: A) => L.List<B>) => (l: L.List<A>) => L.List<B>);
31export declare const every: typeof L.every & (<A>(predicate: (a: A) => boolean) => (l: List<A>) => boolean);
32export declare const all: typeof every;
33export declare const some: typeof every;
34export declare const any: typeof every;
35export declare const none: typeof every;
36export declare const find: typeof L.find & (<A>(predicate: (a: A) => boolean) => (l: List<A>) => A | undefined);
37export declare const findLast: typeof find;
38export declare const indexOf: typeof L.indexOf & (<A>(element: A) => (l: List<A>) => number);
39export declare const lastIndexOf: typeof indexOf;
40export declare const findIndex: typeof L.findIndex & (<A>(predicate: (a: A) => boolean) => (l: List<A>) => number);
41export declare const includes: typeof L.includes & (<A>(element: A) => (l: List<A>) => number);
42export declare const contains: typeof L.includes & (<A>(element: A) => (l: L.List<A>) => number);
43export declare const equals: typeof L.equals & (<A>(first: List<A>) => (second: List<A>) => boolean);
44export declare const concat: typeof L.concat & (<A>(left: List<A>) => (right: List<A>) => List<A>);
45export declare const take: typeof L.take & ((n: number) => <A>(l: List<A>) => List<A>);
46export declare const takeLast: typeof take;
47export declare const drop: typeof take;
48export declare const dropRepeatsWith: typeof L.dropRepeatsWith & (<A>(f: (a: A, b: A) => boolean) => (l: List<A>) => List<A>);
49export declare const dropLast: typeof take;
50export declare const takeWhile: typeof filter;
51export declare const takeLastWhile: typeof filter;
52export declare const dropWhile: typeof filter;
53export declare const splitAt: typeof L.splitAt & ((index: number) => <A>(l: List<A>) => [List<A>, List<A>]);
54export declare const splitWhen: typeof L.splitWhen & (<A>(predicate: (a: A) => boolean) => (l: List<A>) => [List<A>, List<A>]);
55export declare const splitEvery: typeof L.splitEvery & (<A>(size: number) => (l: List<A>) => List<List<A>>);
56export declare const sortBy: typeof L.sortBy & (<A, B extends L.Comparable>(f: (a: A) => B) => (l: List<A>) => List<A>);
57export declare const sortWith: typeof L.sortWith & (<A>(comparator: (a: A, b: A) => L.Ordering) => (l: List<A>) => List<A>);
58export declare const groupWith: typeof L.groupWith & (<A>(f: (a: A, b: A) => boolean) => (l: List<A>) => List<List<A>>);
59export declare const zip: typeof L.zip & (<A>(as: List<A>) => <B>(bs: List<B>) => List<[A, B]>);
60export declare const sequence: typeof L.sequence & ((ofObj: L.Of) => <A>(l: List<L.Applicative<A>>) => any);
61export declare const foldl: typeof L.foldl & {
62 <A, B>(f: (acc: B, value: A) => B): Curried2<B, List<A>, B>;
63 <A, B>(f: (acc: B, value: A) => B, initial: B): (l: List<A>) => B;
64};
65export declare const reduce: typeof foldl;
66export declare const scan: typeof L.scan & {
67 <A, B>(f: (acc: B, value: A) => B): Curried2<B, List<A>, List<B>>;
68 <A, B>(f: (acc: B, value: A) => B, initial: B): (l: List<A>) => List<B>;
69};
70export declare const foldr: typeof L.foldl & {
71 <A, B>(f: (value: A, acc: B) => B): Curried2<B, List<A>, B>;
72 <A, B>(f: (value: A, acc: B) => B, initial: B): (l: List<A>) => B;
73};
74export declare const traverse: typeof L.traverse & {
75 (of: L.Of): (<A, B>(f: (a: A) => L.Applicative<B>) => (l: List<B>) => any) & (<A, B>(f: (a: A) => L.Applicative<B>, l: List<B>) => any);
76 <A, B>(of: L.Of, f: (a: A) => L.Applicative<B>): (l: List<B>) => any;
77};
78export declare const equalsWith: typeof L.equalsWith & {
79 <A>(f: (a: A, b: A) => boolean): Curried2<List<A>, List<A>, boolean>;
80 <A>(f: (a: A, b: A) => boolean, l1: List<A>): (l2: List<A>) => boolean;
81};
82export declare const reduceRight: typeof foldr;
83export declare const update: typeof L.update & {
84 <A>(index: number, a: A): (l: List<A>) => List<A>;
85 <A>(index: number): ((a: A, l: List<A>) => List<A>) & ((a: A) => (l: List<A>) => List<A>);
86};
87export declare const adjust: typeof L.adjust & {
88 <A>(index: number, f: (value: A) => A): (l: List<A>) => List<A>;
89 (index: number): <A>(f: (value: A) => A, l: List<A>) => List<A> & (<A>(f: (value: A) => A) => (l: List<A>) => List<A>);
90};
91export declare const slice: typeof L.slice & {
92 (from: number): (<A>(to: number) => (l: List<A>) => List<A>) & (<A>(to: number, l: List<A>) => List<A>);
93 (from: number, to: number): <A>(l: List<A>) => List<A>;
94};
95export declare const remove: typeof slice;
96export declare const insert: typeof update;
97export declare const insertAll: typeof L.insertAll & {
98 <A>(index: number, elements: List<A>): (l: List<A>) => List<A>;
99 <A>(index: number): ((elements: List<A>, l: List<A>) => List<A>) & ((elements: List<A>) => (l: List<A>) => List<A>);
100};
101export declare const zipWith: typeof L.zipWith & {
102 <A, B, C>(f: (a: A, b: B) => C, as: List<A>): (bs: List<B>) => List<C>;
103 <A, B, C>(f: (a: A, b: B) => C): Curried2<List<A>, List<B>, List<C>>;
104};
105export declare const foldlWhile: typeof L.foldlWhile & {
106 <A, B>(predicate: (acc: B, value: A) => boolean, f: (acc: B, value: A) => B, initial: B): (l: List<A>) => B;
107 <A, B>(predicate: (acc: B, value: A) => boolean, f: (acc: B, value: A) => B): Curried2<B, List<A>, B>;
108 <A, B>(predicate: (acc: B, value: A) => boolean): Curried3<(acc: B, value: A) => B, B, List<A>, B>;
109};
110export declare const reduceWhile: typeof foldlWhile;