UNPKG

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