mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-26 11:12:19 +08:00
Merge pull request #3771 from AyaMorisawa/prelude-ls
Add prelude-ls.d.ts
This commit is contained in:
@@ -0,0 +1,365 @@
|
||||
import prelude = require("prelude-ls");
|
||||
|
||||
prelude.id(5); //=> 5
|
||||
prelude.id({}); //=> {}
|
||||
|
||||
prelude.isType("Undefined", void 8); //=> true
|
||||
prelude.isType("Boolean", true); //=> true
|
||||
prelude.isType("Number", 1); //=> true
|
||||
prelude.isType("String", "hi"); //=> true
|
||||
prelude.isType("Object", {}); //=> true
|
||||
prelude.isType("Array", []); //=> true
|
||||
|
||||
prelude.replicate(4, 3); //=> [3, 3, 3, 3]
|
||||
prelude.replicate(4, "a"); //=> ["a", "a", "a", "a"]
|
||||
prelude.replicate(0, "a"); //=> []
|
||||
|
||||
|
||||
// List
|
||||
|
||||
prelude.each(x => x.push("boom"), [["a"], ["b"], ["c"]]);
|
||||
//=> [["a", "boom"], ["b", "boom"], ["c", "boom"]]
|
||||
|
||||
prelude.map(x => x * 2, [1, 2, 3, 4, 5]); //=> [2, 4, 6, 8, 10]
|
||||
prelude.map(x => x.toUpperCase(), ["ha", "ma"]); //=> ["HA", "MA"]
|
||||
prelude.map(x => x.num, [{num: 3}, {num: 1}]); //=> [3, 1]
|
||||
|
||||
prelude.compact([0, 1, false, true, "", "ha"]) //=> [1, true, "ha"]
|
||||
|
||||
prelude.filter(x => x < 3, [1, 2, 3, 4, 5]); //=> [1, 2]
|
||||
prelude.filter(prelude.even, [3, 4, 0]); //=> [4, 0]
|
||||
|
||||
prelude.reject(prelude.odd, [1, 2, 3, 4, 5]); //=> [2, 4]
|
||||
|
||||
prelude.partition(x => x > 60, [49, 58, 76, 43, 88, 77, 90]); //=> [[76, 88, 77, 90], [49, 58, 43]]
|
||||
|
||||
prelude.find(prelude.odd, [2, 4, 6, 7, 8, 9, 10]); //=> 7
|
||||
|
||||
prelude.head([1, 2, 3, 4, 5]); //=> 1
|
||||
|
||||
prelude.tail([1, 2, 3, 4, 5]); //=> [2, 3, 4, 5]
|
||||
|
||||
prelude.last([1, 2, 3, 4, 5]); //=> 5
|
||||
|
||||
prelude.initial([1, 2, 3, 4, 5]); //=> [1, 2, 3, 4]
|
||||
|
||||
prelude.empty([]); //=> true
|
||||
|
||||
prelude.reverse([1, 2, 3]); //=> [3, 2, 1]
|
||||
|
||||
prelude.unique([1, 1, 1, 3, 3, 6, 7, 8]); //=> [1, 3, 6, 7, 8]
|
||||
|
||||
prelude.uniqueBy(x => x.length, ["and", "here", "are", "some", "words"]); //=> ["and", "here", "words"]
|
||||
|
||||
prelude.fold(x => y => x + y, 0, [1, 2, 3, 4, 5]); //=> 15
|
||||
var product = prelude.fold<number, number>(x => y => x * y, 1);
|
||||
|
||||
prelude.fold1(x => y => x + y, [1, 2, 3]); //=> 6
|
||||
|
||||
prelude.foldr(x => y => x - y, 9, [1, 2, 3, 4]); //=> 7
|
||||
prelude.foldr(x => y => x + y, "e", ["a", "b", "c", "d"]); //=> "abcde"
|
||||
|
||||
prelude.foldr1(x => y => x - y, [1, 2, 3, 4, 9]); //=> 7
|
||||
|
||||
prelude.unfoldr(x => x === 0 ? null : [x, x - 1], 10);
|
||||
//=> [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
|
||||
|
||||
prelude.concat([[1], [2, 3], [4]]); //=> [1, 2, 3, 4]
|
||||
|
||||
prelude.concatMap(x => ["hoge", x, x + 2], [1, 2, 3]); //=> ["hoge", 1, 3, "hoge", 2, 4, "hoge", 3, 5]
|
||||
|
||||
prelude.flatten([1, [[2], 3], [4, [[5]]]]); //=> [1, 2, 3, 4, 5]
|
||||
|
||||
prelude.difference([1, 2, 3], [1]); //=> [2, 3]
|
||||
prelude.difference([1, 2, 3, 4, 5], [5, 2, 10], [9]); //=> [1, 3, 4]
|
||||
|
||||
prelude.intersection([2, 3], [9, 8], [12, 1], [99]); //=> []
|
||||
prelude.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1], [-1, 0, 1, 2]); //=> [1, 2]
|
||||
prelude.intersection([1, 2, 3], [2, 1, 3], [3, 1, 2]); //=> [1, 2, 3]
|
||||
|
||||
prelude.union([1, 5, 7], [3, 5], []); //=> [1, 5, 7, 3]
|
||||
|
||||
prelude.countBy(prelude.floor, [4.2, 6.1, 6.4]); //=> {4: 1, 6: 2}
|
||||
prelude.countBy(x => x.length, ["one", "two", "three"]); //=> {3: 2, 5: 1}
|
||||
|
||||
prelude.groupBy(prelude.floor, [4.2, 6.1, 6.4]); //=> {4: [4.2], 6: [6.1, 6.4]}
|
||||
prelude.groupBy(x => x.length, ["one", "two", "three"]); //=> {3: ["one", "two"], 5: ["three"]}
|
||||
|
||||
prelude.andList([true, 2 + 2 == 4]); //=> true
|
||||
prelude.andList([true, true, false]); //=> false
|
||||
prelude.andList([]); //=> true
|
||||
|
||||
prelude.orList([false, false, true, false]); //=> true
|
||||
prelude.orList([]); //=> false
|
||||
|
||||
prelude.any(prelude.even, [3, 5, 7, 8, 9]); //=> true
|
||||
prelude.any(prelude.even, []); //=> false
|
||||
|
||||
prelude.all(prelude.isType("String"), ["ha", "ma", "la"]); //=> true
|
||||
prelude.all(prelude.isType("String"), []); //=> true
|
||||
|
||||
prelude.sort([3, 1, 5, 2, 4, 6]); //=> [1, 2, 3, 4, 5, 6]
|
||||
|
||||
var f = (x: string) => (y: string) =>
|
||||
x.length > y.length ?
|
||||
1
|
||||
: x.length < y.length ?
|
||||
-1
|
||||
:
|
||||
0;
|
||||
prelude.sortWith(f, ["three", "one", "two"]); //=> ["one", "two", "three"]
|
||||
|
||||
prelude.sortBy(x => x.length, ["there", "hey", "a", "ha"]); //=> ["a", "ha", "hey", "there"]
|
||||
|
||||
var table = [{
|
||||
id: 1,
|
||||
name: "george"
|
||||
}, {
|
||||
id: 2,
|
||||
name: "mike"
|
||||
}, {
|
||||
id: 3,
|
||||
name: "donald"
|
||||
}];
|
||||
prelude.sortBy(x => x.name, table);
|
||||
//=> [{"id": 3, "name": "donald"}, {"id": 1, "name": "george"}, {"id": 2, "name": "mike"}]
|
||||
|
||||
prelude.sum([1, 2, 3, 4, 5]); //=> 15
|
||||
prelude.sum([]); //=> 0
|
||||
|
||||
prelude.product([1, 2, 3]); //=> 6
|
||||
prelude.product([]); //=> 1
|
||||
|
||||
prelude.mean([1, 2, 3, 4, 5]); //=> 3
|
||||
|
||||
prelude.maximum([4, 1, 9, 3]); //=> 9
|
||||
|
||||
prelude.minimum(["c", "e", "a", "d", "b"]); //=> "a"
|
||||
|
||||
prelude.maximumBy(x => x.length, ["hi", "there", "I", "am", "looooong"]); //=> "looooong"
|
||||
|
||||
prelude.maximumBy(x => x.length, ["hi", "there", "I", "am", "looooong"]); //=> "looooong"
|
||||
|
||||
prelude.scan(x => y => x + y, 0, [1, 2, 3]); //=> [0, 1, 3, 6]
|
||||
|
||||
prelude.scan1(x => y => x + y, [1, 2, 3]); //=> [1, 3, 6]
|
||||
|
||||
prelude.scanr(x => y => x + y, 0, [1, 2, 3]); //=> [6, 5, 3, 0]
|
||||
|
||||
prelude.scanr1(x => y => x + y, [1, 2, 3]); //=> [6, 5, 3]
|
||||
|
||||
prelude.slice(2, 4, [1, 2, 3, 4, 5]); //=> [3, 4]
|
||||
|
||||
prelude.take(2, [1, 2, 3, 4, 5]); //=> [1, 2]
|
||||
|
||||
prelude.drop(2, [1, 2, 3, 4, 5]); //=> [3, 4, 5]
|
||||
|
||||
prelude.splitAt(2, [1, 2, 3, 4, 5]); //=> [[1, 2], [3, 4, 5]]
|
||||
|
||||
prelude.takeWhile(prelude.odd, [1, 3, 5, 4, 8, 7, 9]); //=> [1, 3, 5]
|
||||
|
||||
prelude.dropWhile(prelude.even, [2, 4, 5, 6]); //=> [5, 6]
|
||||
|
||||
prelude.span(prelude.even, [2, 4, 5, 6]); //=> [[2, 4], [5, 6]]
|
||||
|
||||
prelude.breakList(x => x == 3, [1, 2, 3, 4, 5]); //=> [[1, 2], [3, 4, 5]]
|
||||
|
||||
prelude.zip([1, 2, 3], [4, 5, 6]); //=> [[1, 4], [2, 5], [3, 6]]
|
||||
|
||||
prelude.zipWith(x => y => x + y, [1, 2, 3], [4, 5, 6]); //=> [5, 7, 9]
|
||||
|
||||
prelude.zipAll([1, 2, 3], [4, 5, 6], [7, 8, 9]); //=> [[1, 4, 7], [2, 5, 8], [3, 6, 9]]
|
||||
|
||||
prelude.zipAllWith((a, b, c) => a + b + c, [1, 2, 3], [3, 2, 1], [1, 1, 1]); //=> [5, 5, 5]
|
||||
|
||||
prelude.at(2, [1, 2, 3, 4]); //=> 3
|
||||
prelude.at(-3, [1, 2, 3, 4]); //=> 2
|
||||
|
||||
prelude.elemIndex("a", ["c", "a", "b", "a"]); //=> 1
|
||||
|
||||
prelude.elemIndices("a", ["c", "a", "b", "a"]); //=> [1, 3]
|
||||
|
||||
prelude.findIndex(prelude.even, [1, 2, 3, 4]); //=> 1
|
||||
|
||||
prelude.findIndices(prelude.even, [1, 2, 3, 4]); //=> [1, 3]
|
||||
|
||||
// Obj
|
||||
|
||||
prelude.keys({a: 2, b: 3, c: 9}); //=> ["a", "b", "c"]
|
||||
|
||||
prelude.values({a: 2, b: 3, c: 9}); //=> [2, 3, 9]
|
||||
|
||||
prelude.pairsToObj<string | number>([["a", "b"], ["c", "d"], ["e", 1]]); //=> {a: "b", c: "d", e: 1}
|
||||
|
||||
prelude.objToPairs({a: "b", c: "d", e: 1}); //=> [["a", "b"], ["c", "d"], ["e", 1]]
|
||||
|
||||
prelude.listsToObj(["a", "b", "c"], [1, 2, 3]); //=> {a: 1, b: 2, c: 3}
|
||||
|
||||
prelude.objToLists({a: 1, b: 2, c: 3}); //=> [["a", "b", "c"], [1, 2, 3]]
|
||||
|
||||
prelude.Obj.empty({}); //=> true
|
||||
|
||||
var count = 4;
|
||||
prelude.Obj.each(x => count += x, {a: 1, b: 2, c: 3});
|
||||
count; //=> 10
|
||||
|
||||
prelude.Obj.map(x => x + 2, {a: 2, b: 3, c: 4}); //=> {a: 4, b: 5, c: 6}
|
||||
|
||||
prelude.Obj.compact({a: 0, b: 1, c: false, d: "", e: "ha"}); //=> {b: 1, e: "ha"}
|
||||
|
||||
prelude.Obj.filter(prelude.even, {a: 3, b: 4, c: 0}); //=> {b: 4, c: 0}
|
||||
|
||||
prelude.Obj.reject(x => x == 2, {a: 1, b: 2}); //=> {a: 1}
|
||||
|
||||
prelude.Obj.partition(x => x == 2, {a: 1, b: 2, c: 3}); //=> [{b: 2}, {a: 1, c: 3}]
|
||||
|
||||
prelude.Obj.find(prelude.even, {a: 1, b: 2, c: 3, d: 4}); //=> 2
|
||||
|
||||
|
||||
// Str
|
||||
|
||||
prelude.split("|", "1|2|3"); //=> ["1", "2", "3"]
|
||||
prelude.join("|", ["1", "2", "3"]); //=> "1|2|3"
|
||||
|
||||
prelude.lines("one\ntwo\nthree");
|
||||
//=> ["one", "two", "three"]
|
||||
|
||||
prelude.unlines(["one", "two", "three"]);
|
||||
//=> "one\ntwo\nthree"
|
||||
|
||||
prelude.words("hello, what is that?");
|
||||
//=> ["hello,", "what", "is", "that?"]
|
||||
|
||||
prelude.unwords(["one", "two", "three"]); //=> "one two three"
|
||||
|
||||
prelude.chars("hello"); //=> ["h", "e", "l", "l", "o"]
|
||||
|
||||
prelude.unchars(["t", "h", "e", "r", "e"]); //=> "there"
|
||||
prelude.unchars(["ma", "ma"]); //=> "mama"
|
||||
|
||||
prelude.repeat(4, "a"); //=> "aaaa"
|
||||
prelude.repeat(2, "ha"); //=> "haha"
|
||||
|
||||
prelude.capitalize("hi there"); //=> "Hi there"
|
||||
|
||||
prelude.camelize("hi-there"); //=> "hiThere"
|
||||
prelude.camelize("hi_there"); //=> "hiThere"
|
||||
|
||||
prelude.dasherize("hiThere"); //=> "hi-there"
|
||||
prelude.dasherize("FooBar"); //=> "foo-bar"
|
||||
prelude.dasherize("innerHTML"); //=> "inner-HTML"
|
||||
|
||||
prelude.empty(""); //=> true
|
||||
|
||||
prelude.reverse("goat"); //=> "taog"
|
||||
|
||||
prelude.slice(2, 4, "hello"); //=> "ll"
|
||||
|
||||
prelude.take(4, "hello"); //=> "hell"
|
||||
|
||||
prelude.drop(1, "goat"); //=> "oat"
|
||||
|
||||
prelude.splitAt(4, "hello"); //=> ["hell", "o"]
|
||||
|
||||
prelude.takeWhile(x => !prelude.empty(prelude.elemIndices(x, ["a", "b", "c", "d"])), "cabdek"); //=> "cabd"
|
||||
|
||||
prelude.dropWhile(x => x === "m", "mmmmmhmm"); //=> "hmm"
|
||||
|
||||
prelude.span(x => x === "m", "mmmmmhmm"); //=> ["mmmmm", "hmm"]
|
||||
|
||||
prelude.Str.breakStr(x => x === "h", "mmmmmhmm"); //=> ["mmmmm", "hmm"]
|
||||
|
||||
|
||||
// Func
|
||||
|
||||
prelude.apply((x, y) => x + y, [2, 3]); //=> 5
|
||||
|
||||
var add = (x: number, y: number) => x + y;
|
||||
var addCurried = prelude.curry(add);
|
||||
var addFour = addCurried(4);
|
||||
addFour(2); //=> 6
|
||||
|
||||
var invertedPower = prelude.flip<number, number, number>(x => y => Math.pow(x, y));
|
||||
invertedPower(2)(3); //=> 9
|
||||
|
||||
prelude.fix((fib: (n: number) => number) => (n: number) => n <= 1 ? 1 : fib(n - 1) + fib(n - 2))(9); //=> 55
|
||||
|
||||
var sameLength = prelude.over<string, number, boolean>((x, y) => x == y, x => x.length);
|
||||
sameLength('hi', 'me'); //=> true
|
||||
sameLength('one', 'boom'); //=> false
|
||||
|
||||
// Num
|
||||
|
||||
prelude.max(3, 1); //=> 3
|
||||
prelude.max("a", "c"); //=> "c"
|
||||
|
||||
prelude.min(3, 1); //=> 1
|
||||
prelude.min("a", "c"); //=> "a"
|
||||
|
||||
prelude.negate(3); //=> -3
|
||||
prelude.negate(-2); //=> 2
|
||||
|
||||
prelude.abs(-2); //=> 2
|
||||
prelude.abs(2); //=> 2
|
||||
|
||||
prelude.signum(-5); //=> -1
|
||||
prelude.signum(0); //=> 0
|
||||
prelude.signum(9); //=> 1
|
||||
|
||||
prelude.quot(-20, 3); //=> -6
|
||||
|
||||
prelude.rem(-20, 3); //=> -2
|
||||
|
||||
prelude.div(-20, 3); //=> -7
|
||||
|
||||
prelude.mod(-20, 3); //=> 1
|
||||
|
||||
prelude.recip(4); //=> 0.25
|
||||
|
||||
prelude.pi; //=> 3.141592653589793
|
||||
|
||||
prelude.tau; //=> 6.283185307179586
|
||||
|
||||
prelude.exp(1); //=> 2.718281828459045
|
||||
|
||||
prelude.sqrt(4); //=> 2
|
||||
|
||||
prelude.ln(10); //=> 2.302585092994046
|
||||
|
||||
prelude.pow(-2, 2); //=> 4
|
||||
|
||||
prelude.sin(prelude.pi / 2); //=> 1
|
||||
|
||||
prelude.cos(prelude.pi); //=> -1
|
||||
|
||||
prelude.tan(prelude.pi / 4); //=> 1
|
||||
|
||||
prelude.asin(0); //=> 0
|
||||
|
||||
prelude.acos(1); //=> 0
|
||||
|
||||
prelude.atan(0); //=> 0
|
||||
|
||||
prelude.atan2(1, 0); //=> 1.5707963267948966
|
||||
|
||||
prelude.truncate(-1.5); //=> -1
|
||||
prelude.truncate(1.5); //=> 1
|
||||
|
||||
prelude.round(0.6); //=> 1
|
||||
prelude.round(0.5); //=> 1
|
||||
prelude.round(0.4); //=> 0
|
||||
|
||||
prelude.ceiling(0.1); //=> 1
|
||||
|
||||
prelude.floor(0.9); //=> 0
|
||||
|
||||
prelude.isItNaN(prelude.sqrt(-1)); //=> true
|
||||
|
||||
prelude.even(4); //=> true
|
||||
prelude.even(0); //=> true
|
||||
|
||||
prelude.odd(3); //=> true
|
||||
|
||||
prelude.gcd(12, 18); //=> 6
|
||||
|
||||
prelude.lcm(12, 18); //=> 36
|
||||
Vendored
+338
@@ -0,0 +1,338 @@
|
||||
// Type definitions for prelude.ls 1.1.1
|
||||
// Project: http://www.preludels.com
|
||||
// Definitions by: Aya Morisawa <https://github.com/AyaMorisawa>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "prelude-ls" {
|
||||
module PreludeLS {
|
||||
export function id<A>(x: A): A;
|
||||
export function isType<A>(type: string): (x: A) => boolean;
|
||||
export function isType<A>(type: string, x: A): boolean;
|
||||
export function replicate<A>(n: number): (x: A) => A[];
|
||||
export function replicate<A>(n: number, x: A): A[];
|
||||
|
||||
|
||||
// List
|
||||
|
||||
export function each<A>(f: (x: A) => void): (xs: A[]) => void;
|
||||
export function each<A>(f: (x: A) => void, xs: A[]): void;
|
||||
export function map<A, B>(f: (x: A) => B): (xs: A[]) => B[];
|
||||
export function map<A, B>(f: (x: A) => B, xs: A[]): B[];
|
||||
export function compact<A>(xs: A[]): A[];
|
||||
export function filter<A>(f: (x: A) => boolean): (xs: A[]) => A[];
|
||||
export function filter<A>(f: (x: A) => boolean, xs: A[]): A[];
|
||||
export function reject<A>(f: (x: A) => boolean): (xs: A[]) => A[];
|
||||
export function reject<A>(f: (x: A) => boolean, xs: A[]): A[];
|
||||
export function partition<A>(f: (x: A) => Boolean): (xs: A[]) => [A[], A[]];
|
||||
export function partition<A>(f: (x: A) => Boolean, xs: A[]): [A[], A[]];
|
||||
export function find<A>(f: (x: A) => Boolean): (xs: A[]) => (A | void);
|
||||
export function find<A>(f: (x: A) => Boolean, xs: A[]): (A | void);
|
||||
export function head<A>(xs: A[]): (A | void);
|
||||
export function tail<A>(xs: A[]): A[];
|
||||
export function last<A>(xs: A[]): (A | void);
|
||||
export function initial<A>(xs: A[]): A[];
|
||||
export function empty<A>(xs: A[]): boolean;
|
||||
export function reverse<A>(xs: A[]): A[];
|
||||
export function unique<A>(xs: A[]): A[];
|
||||
export function uniqueBy<A, B>(f: (x: A) => B): (xs: A[]) => A[];
|
||||
export function uniqueBy<A, B>(f: (x: A) => B, xs: A[]): A[];
|
||||
export function fold<A, B>(f: (x: A) => (y: B) => A): (memo: A) => (xs: B[]) => A;
|
||||
export function fold<A, B>(f: (x: A) => (y: B) => A, memo: A): (xs: B[]) => A;
|
||||
export function fold<A, B>(f: (x: A) => (y: B) => A, memo: A, xs: B[]): A;
|
||||
export function foldl<A, B>(f: (x: A) => (y: B) => A): (memo: A) => (xs: B[]) => A;
|
||||
export function foldl<A, B>(f: (x: A) => (y: B) => A, memo: A): (xs: B[]) => A;
|
||||
export function foldl<A, B>(f: (x: A) => (y: B) => A, memo: A, xs: B[]): A;
|
||||
export function fold1<A>(f: (x: A) => (y: A) => A): (xs: A[]) => A;
|
||||
export function fold1<A>(f: (x: A) => (y: A) => A, xs: A[]): A;
|
||||
export function foldl1<A>(f: (x: A) => (y: A) => A): (xs: A[]) => A;
|
||||
export function foldl1<A>(f: (x: A) => (y: A) => A, xs: A[]): A;
|
||||
export function foldr<A, B>(f: (x: A) => (y: B) => B): (memo: B) => (xs: A[]) => B;
|
||||
export function foldr<A, B>(f: (x: A) => (y: B) => B, memo: B): (xs: A[]) => B;
|
||||
export function foldr<A, B>(f: (x: A) => (y: B) => B, memo: B, xs: A[]): B;
|
||||
export function foldr1<A>(f: (x: A) => (y: A) => A): (xs: A[]) => A;
|
||||
export function foldr1<A>(f: (x: A) => (y: A) => A, xs: A[]): A;
|
||||
export function unfoldr<A, B>(f: (x: B) => ([A, B] | void)): (x: B) => A[];
|
||||
export function unfoldr<A, B>(f: (x: B) => ([A, B] | void), x: B): A[];
|
||||
export function concat<A>(xss: A[][]): A[];
|
||||
export function concatMap<A, B>(f: (x: A) => B[]): (xs: A[]) => B[];
|
||||
export function concatMap<A, B>(f: (x: A) => B[], xs: A[]): B[];
|
||||
export function flatten(xs: any[]): any[];
|
||||
export function difference<A>(...xss: A[][]): A[];
|
||||
export function intersection<A>(...xss: A[]): A[];
|
||||
export function union<A>(...xss: A[]): A[];
|
||||
export function countBy<A, B>(f: (x: A) => B): (xs: A[]) => any;
|
||||
export function countBy<A, B>(f: (x: A) => B, xs: A[]): any;
|
||||
export function groupBy<A, B>(f: (x: A) => B): (xs: A[]) => any;
|
||||
export function groupBy<A, B>(f: (x: A) => B, xs: A[]): any;
|
||||
export function andList<A>(xs: A[]): boolean;
|
||||
export function orList<A>(xs: A[]): boolean;
|
||||
export function any<A>(f: (x: A) => boolean): (xs: A[]) => boolean;
|
||||
export function any<A>(f: (x: A) => boolean, xs: A[]): boolean;
|
||||
export function all<A>(f: (x: A) => boolean): (xs: A[]) => boolean;
|
||||
export function all<A>(f: (x: A) => boolean, xs: A[]): boolean;
|
||||
export function sort<A>(xs: A[]): A[];
|
||||
export function sortWith<A>(f: (x: A) => (y: A) => number): (xs: A[]) => A[];
|
||||
export function sortWith<A>(f: (x: A) => (y: A) => number, xs: A[]): A[];
|
||||
export function sortBy<A, B>(f: (x: A) => B): (xs: A[]) => A;
|
||||
export function sortBy<A, B>(f: (x: A) => B, xs: A[]): A;
|
||||
export function sum(xs: number[]): number[];
|
||||
export function product(xs: number[]): number[];
|
||||
export function mean(xs: number[]): number[];
|
||||
export function maximum<A>(xs: A[]): A;
|
||||
export function minimum<A>(xs: A[]): A;
|
||||
export function maximumBy<A, B>(f: (x: A) => B): (xs: A[]) => A;
|
||||
export function maximumBy<A, B>(f: (x: A) => B, xs: A[]): A;
|
||||
export function minimumBy<A, B>(f: (x: A) => B): (xs: A[]) => A;
|
||||
export function minimumBy<A, B>(f: (x: A) => B, xs: A[]): A;
|
||||
export function scan<A, B>(f: (x: A) => (y: B) => A): (memo: A) => (xs: B[]) => A[];
|
||||
export function scan<A, B>(f: (x: A) => (y: B) => A, memo: A): (xs: B[]) => A[];
|
||||
export function scan<A, B>(f: (x: A) => (y: B) => A, memo: A, xs: B[]): A[];
|
||||
export function scanl<A, B>(f: (x: A) => (y: B) => A): (memo: A) => (xs: B[]) => A[];
|
||||
export function scanl<A, B>(f: (x: A) => (y: B) => A, memo: A): (xs: B[]) => A[];
|
||||
export function scanl<A, B>(f: (x: A) => (y: B) => A, memo: A, xs: B[]): A[];
|
||||
export function scan1<A>(f: (x: A) => (y: A) => A): (xs: A[]) => A[];
|
||||
export function scan1<A>(f: (x: A) => (y: A) => A, xs: A[]): A[];
|
||||
export function scanl1<A>(f: (x: A) => (y: A) => A): (xs: A[]) => A[];
|
||||
export function scanl1<A>(f: (x: A) => (y: A) => A, xs: A[]): A[];
|
||||
export function scanr<A, B>(f: (x: A) => (y: B) => B): (memo: B) => (xs: A[]) => B[];
|
||||
export function scanr<A, B>(f: (x: A) => (y: B) => B, memo: B): (xs: A[]) => B[];
|
||||
export function scanr<A, B>(f: (x: A) => (y: B) => B, memo: B, xs: A[]): B[];
|
||||
export function scanr1<A>(f: (x: A) => (y: A) => A): (xs: A[]) => A[];
|
||||
export function scanr1<A>(f: (x: A) => (y: A) => A, xs: A[]): A[];
|
||||
export function slice<A>(x: number): (y: number) => (xs: A[]) => A[];
|
||||
export function slice<A>(x: number, y: number): (xs: A[]) => A[];
|
||||
export function slice<A>(x: number, y: number, xs: A[]): A[];
|
||||
export function take<A>(n: number): (xs: A[]) => A[];
|
||||
export function take<A>(n: number, xs: A[]): A[];
|
||||
export function drop<A>(n: number): (xs: A[]) => A[];
|
||||
export function drop<A>(n: number, xs: A[]): A[];
|
||||
export function splitAt<A>(n: number): (xs: A[]) => [A[], A[]];
|
||||
export function splitAt<A>(n: number, xs: A[]): [A[], A[]];
|
||||
export function takeWhile<A>(p: (x: A) => boolean): (xs: A[]) => A[];
|
||||
export function takeWhile<A>(p: (x: A) => boolean, xs: A[]): A[];
|
||||
export function dropWhile<A>(p: (x: A) => boolean): (xs: A[]) => A[];
|
||||
export function dropWhile<A>(p: (x: A) => boolean, xs: A[]): A[];
|
||||
export function span<A>(p: (x: A) => boolean): (xs: A[]) => [A[], A[]];
|
||||
export function span<A>(p: (x: A) => boolean, xs: A[]): [A[], A[]];
|
||||
export function breakList<A>(p: (x: A) => boolean): (xs: A[]) => [A[], A[]];
|
||||
export function breakList<A>(p: (x: A) => boolean, xs: A[]): [A[], A[]];
|
||||
export function zip<A, B>(xs: A[]): (ys: B[]) => [A, B][];
|
||||
export function zip<A, B>(xs: A[], ys: B[]): [A, B][];
|
||||
export function zipWith<A, B, C>(f: (x: A) => (y: B) => C): (xs: A[]) => (ys: B[]) => C[];
|
||||
export function zipWith<A, B, C>(f: (x: A) => (y: B) => C, xs: A[]): (ys: B[]) => C[];
|
||||
export function zipWith<A, B, C>(f: (x: A) => (y: B) => C, xs: A[], ys: B[]): C[];
|
||||
export function zipAll<A>(...xss: A[][]): A[][];
|
||||
export function zipAllWith<A, B>(f: (...xs: A[]) => B, ...xss: A[][]): B[];
|
||||
export function at<A>(n: number): (xs: A[]) => A;
|
||||
export function at<A>(n: number, xs: A[]): A;
|
||||
export function elemIndex<A>(x: A): (xs: A[]) => number;
|
||||
export function elemIndex<A>(x: A, xs: A[]): number;
|
||||
export function elemIndices<A>(x: A): (xs: A[]) => number[];
|
||||
export function elemIndices<A>(x: A, xs: A[]): number[];
|
||||
export function findIndex<A>(f: (x: A) => boolean): (xs: A[]) => number;
|
||||
export function findIndex<A>(f: (x: A) => boolean, xs: A[]): number;
|
||||
export function findIndices<A>(f: (x: A) => boolean): (xs: A[]) => number[];
|
||||
export function findIndices<A>(f: (x: A) => boolean, xs: A[]): number[];
|
||||
|
||||
|
||||
// Obj
|
||||
|
||||
export function keys<A>(object: { [key: string]: A }): string[];
|
||||
export function keys<A>(object: { [key: number]: A }): number[];
|
||||
export function values<A>(object: { [key: string]: A }): A[];
|
||||
export function values<A>(object: { [key: number]: A }): A[];
|
||||
export function pairsToObj<A>(object: [string, A][]): { [key: string]: A };
|
||||
export function pairsToObj<A>(object: [number, A][]): { [key: number]: A };
|
||||
export function objToPairs<A>(object: { [ key: string]: A }): [string, A][];
|
||||
export function objToPairs<A>(object: { [ key: number]: A }): [number, A][];
|
||||
export function listsToObj<A>(keys: string[]): (values: A[]) => { [key: string]: A };
|
||||
export function listsToObj<A>(keys: string[], values: A[]): { [key: string]: A };
|
||||
export function listsToObj<A>(keys: number[]): (values: A[]) => { [key: number]: A };
|
||||
export function listsToObj<A>(keys: number[], values: A[]): { [key: number]: A };
|
||||
export function objToLists<A>(object: { [key: string]: A }): [string[], A[]];
|
||||
export function objToLists<A>(object: { [key: number]: A }): [number[], A[]];
|
||||
export function empty<A>(object: any): boolean;
|
||||
export function each<A>(f: (x: A) => void): (object: { [key: string]: A }) => { [key: string]: A };
|
||||
export function each<A>(f: (x: A) => void, object: { [key: string]: A }): { [key: string]: A };
|
||||
export function each<A>(f: (x: A) => void): (object: { [key: number]: A }) => { [key: number]: A };
|
||||
export function each<A>(f: (x: A) => void, object: { [key: number]: A }): { [key: number]: A };
|
||||
export function map<A, B>(f: (x: A) => B): (object: { [key: string]: A }) => { [key: string]: B };
|
||||
export function map<A, B>(f: (x: A) => B, object: { [key: string]: A }): { [key: string]: B };
|
||||
export function map<A, B>(f: (x: A) => B): (object: { [key: number]: A }) => { [key: number]: B };
|
||||
export function map<A, B>(f: (x: A) => B, object: { [key: number]: A }): { [key: number]: B };
|
||||
export function compact<A>(object: { [key: string]: A }): { [key: string]: A };
|
||||
export function compact<A>(object: { [key: number]: A }): { [key: number]: A };
|
||||
export function filter<A>(f: (x: A) => boolean): (object: { [key: string]: A }) => { [key: string]: A };
|
||||
export function filter<A>(f: (x: A) => boolean, object: { [key: string]: A }): { [key: string]: A };
|
||||
export function filter<A>(f: (x: A) => boolean): (object: { [key: number]: A }) => { [key: number]: A };
|
||||
export function filter<A>(f: (x: A) => boolean, object: { [key: number]: A }): { [key: number]: A };
|
||||
export function reject<A>(f: (x: A) => boolean): (object: { [key: string]: A }) => { [key: string]: A };
|
||||
export function reject<A>(f: (x: A) => boolean, object: { [key: string]: A }): { [key: string]: A };
|
||||
export function reject<A>(f: (x: A) => boolean): (object: { [key: number]: A }) => { [key: number]: A };
|
||||
export function reject<A>(f: (x: A) => boolean, object: { [key: number]: A }): { [key: number]: A };
|
||||
export function partition<A>(f: (x: A) => boolean): (object: { [key: string]: A }) => [{ [key: string]: A }, { [key: string]: A}];
|
||||
export function partition<A>(f: (x: A) => boolean, object: { [key: string]: A }): [{ [key: string]: A }, { [key: string]: A}];
|
||||
export function partition<A>(f: (x: A) => boolean): (object: { [key: number]: A }) => [{ [key: number]: A }, { [key: number]: A}];
|
||||
export function partition<A>(f: (x: A) => boolean, object: { [key: number]: A }): [{ [key: number]: A }, { [key: number]: A}];
|
||||
export function find<A>(f: (x: A) => boolean): (object: { [key: string]: A }) => A;
|
||||
export function find<A>(f: (x: A) => boolean, object: { [key: string]: A }): A;
|
||||
export function find<A>(f: (x: A) => boolean): (object: { [key: number]: A }) => A;
|
||||
export function find<A>(f: (x: A) => boolean, object: { [key: number]: A }): A;
|
||||
|
||||
export module Obj {
|
||||
export function empty<A>(object: any): boolean;
|
||||
export function each<A>(f: (x: A) => void): (object: { [key: string]: A }) => { [key: string]: A };
|
||||
export function each<A>(f: (x: A) => void, object: { [key: string]: A }): { [key: string]: A };
|
||||
export function each<A>(f: (x: A) => void): (object: { [key: number]: A }) => { [key: number]: A };
|
||||
export function each<A>(f: (x: A) => void, object: { [key: number]: A }): { [key: number]: A };
|
||||
export function map<A, B>(f: (x: A) => B): (object: { [key: string]: A }) => { [key: string]: B };
|
||||
export function map<A, B>(f: (x: A) => B, object: { [key: string]: A }): { [key: string]: B };
|
||||
export function map<A, B>(f: (x: A) => B): (object: { [key: number]: A }) => { [key: number]: B };
|
||||
export function map<A, B>(f: (x: A) => B, object: { [key: number]: A }): { [key: number]: B };
|
||||
export function compact<A>(object: { [key: string]: A }): { [key: string]: A };
|
||||
export function compact<A>(object: { [key: number]: A }): { [key: number]: A };
|
||||
export function filter<A>(f: (x: A) => boolean): (object: { [key: string]: A }) => { [key: string]: A };
|
||||
export function filter<A>(f: (x: A) => boolean, object: { [key: string]: A }): { [key: string]: A };
|
||||
export function filter<A>(f: (x: A) => boolean): (object: { [key: number]: A }) => { [key: number]: A };
|
||||
export function filter<A>(f: (x: A) => boolean, object: { [key: number]: A }): { [key: number]: A };
|
||||
export function reject<A>(f: (x: A) => boolean): (object: { [key: string]: A }) => { [key: string]: A };
|
||||
export function reject<A>(f: (x: A) => boolean, object: { [key: string]: A }): { [key: string]: A };
|
||||
export function reject<A>(f: (x: A) => boolean): (object: { [key: number]: A }) => { [key: number]: A };
|
||||
export function reject<A>(f: (x: A) => boolean, object: { [key: number]: A }): { [key: number]: A };
|
||||
export function partition<A>(f: (x: A) => boolean): (object: { [key: string]: A }) => [{ [key: string]: A }, { [key: string]: A}];
|
||||
export function partition<A>(f: (x: A) => boolean, object: { [key: string]: A }): [{ [key: string]: A }, { [key: string]: A}];
|
||||
export function partition<A>(f: (x: A) => boolean): (object: { [key: number]: A }) => [{ [key: number]: A }, { [key: number]: A}];
|
||||
export function partition<A>(f: (x: A) => boolean, object: { [key: number]: A }): [{ [key: number]: A }, { [key: number]: A}];
|
||||
export function find<A>(f: (x: A) => boolean): (object: { [key: string]: A }) => A;
|
||||
export function find<A>(f: (x: A) => boolean, object: { [key: string]: A }): A;
|
||||
export function find<A>(f: (x: A) => boolean): (object: { [key: number]: A }) => A;
|
||||
export function find<A>(f: (x: A) => boolean, object: { [key: number]: A }): A;
|
||||
}
|
||||
|
||||
|
||||
// Str
|
||||
|
||||
export function split(separator: string): (str: string) => string[];
|
||||
export function split(separator: string, str: string): string[];
|
||||
export function join(separator: string): (xs: string[]) => string;
|
||||
export function join(separator: string, xs: string[]): string;
|
||||
export function lines(str: string): string[];
|
||||
export function unlines(xs: string[]): string;
|
||||
export function words(str: string): string[];
|
||||
export function unwords(xs: string[]): string;
|
||||
export function chars(str: string): string[];
|
||||
export function unchars(xs: string[]): string;
|
||||
export function repeat(n: number): (str: string) => string;
|
||||
export function repeat(n: number, str: string): string;
|
||||
export function capitalize(str: string): string;
|
||||
export function camelize(str: string): string;
|
||||
export function dasherize(str: string): string;
|
||||
export function empty(str: string): boolean;
|
||||
export function reverse(str: string): string;
|
||||
export function slice(x: number): (y: number) => (str: string) => string;
|
||||
export function slice(x: number, y: number): (str: string) => string;
|
||||
export function slice(x: number, y: number, str: string): string;
|
||||
export function take(n: number): (str: string) => string;
|
||||
export function take(n: number, str: string): string;
|
||||
export function drop(n: number): (str: string) => string;
|
||||
export function drop(n: number, str: string): string;
|
||||
export function splitAt(n: number): (str: string) => [string, string];
|
||||
export function splitAt(n: number, str: string): [string, string];
|
||||
export function takeWhile(f: (str: string) => boolean): (str: string) => string;
|
||||
export function takeWhile(f: (str: string) => boolean, str: string): string;
|
||||
export function dropWhile(f: (str: string) => boolean): (str: string) => string;
|
||||
export function dropWhile(f: (str: string) => boolean, str: string): string;
|
||||
export function span(f: (str: string) => boolean): (str: string) => [string, string];
|
||||
export function span(f: (str: string) => boolean, str: string): [string, string];
|
||||
export function breakStr(f: (str: string) => boolean): (str: string) => [string, string];
|
||||
export function breakStr(f: (str: string) => boolean, str: string): [string, string];
|
||||
|
||||
export module Str {
|
||||
export function empty(str: string): boolean;
|
||||
export function reverse(str: string): string;
|
||||
export function slice(x: number): (y: number) => (str: string) => string;
|
||||
export function slice(x: number, y: number): (str: string) => string;
|
||||
export function slice(x: number, y: number, str: string): string;
|
||||
export function take(n: number): (str: string) => string;
|
||||
export function take(n: number, str: string): string;
|
||||
export function drop(n: number): (str: string) => string;
|
||||
export function drop(n: number, str: string): string;
|
||||
export function splitAt(n: number): (str: string) => [string, string];
|
||||
export function splitAt(n: number, str: string): [string, string];
|
||||
export function takeWhile(f: (str: string) => boolean): (str: string) => string;
|
||||
export function takeWhile(f: (str: string) => boolean, str: string): string;
|
||||
export function dropWhile(f: (str: string) => boolean): (str: string) => string;
|
||||
export function dropWhile(f: (str: string) => boolean, str: string): string;
|
||||
export function span(f: (str: string) => boolean): (str: string) => [string, string];
|
||||
export function span(f: (str: string) => boolean, str: string): [string, string];
|
||||
export function breakStr(f: (str: string) => boolean): (str: string) => [string, string];
|
||||
export function breakStr(f: (str: string) => boolean, str: string): [string, string];
|
||||
}
|
||||
|
||||
|
||||
// Func
|
||||
|
||||
export function apply<A, B>(f: (...args: A[]) => B): (args: A[]) => B;
|
||||
export function apply<A, B>(f: (...args: A[]) => B, args: A[]): B;
|
||||
export function curry(f: Function): Function;
|
||||
export function flip<A, B, C>(f: (x: A) => (y: B) => C): (y: B) => (x: A) => C;
|
||||
export function flip<A, B, C>(f: (x: A) => (y: B) => C, y: B): (x: A) => C;
|
||||
export function flip<A, B, C>(f: (x: A) => (y: B) => C, y: B, x: A): C;
|
||||
export function fix(f: Function): Function;
|
||||
export function over<A, B, C>(f: (x: B) => (y: B) => C): (g: (x: A) => B) => (x: A) => (y: A) => C;
|
||||
export function over<A, B, C>(f: (x: B, y: B) => C): (g: (x: A) => B) => (x: A, y: A) => C;
|
||||
export function over<A, B, C>(f: (x: B) => (y: B) => C, g: (x: A) => B): (x: A) => (y: A) => C;
|
||||
export function over<A, B, C>(f: (x: B, y: B) => C, g: (x: A) => B): (x: A, y: A) => C;
|
||||
export function over<A, B, C>(f: (x: B) => (y: B) => C, g: (x: A) => B, x: A): (y: A) => C;
|
||||
export function over<A, B, C>(f: (x: B, y: B) => C, g: (x: A) => B, x: A): (y: A) => C;
|
||||
export function over<A, B, C>(f: (x: B) => (y: B) => C, g: (x: A) => B, x: A, y: A): C;
|
||||
export function over<A, B, C>(f: (x: B, y: B) => C, g: (x: A) => B, x: A, y: A): C;
|
||||
|
||||
|
||||
// Num
|
||||
|
||||
export function max<Comparable>(x: Comparable): (y: Comparable) => Comparable;
|
||||
export function max<Comparable>(x: Comparable, y: Comparable): Comparable;
|
||||
export function min<Comparable>(x: Comparable): (y: Comparable) => Comparable;
|
||||
export function min<Comparable>(x: Comparable, y: Comparable): Comparable;
|
||||
export function negate(x: number): number;
|
||||
export function abs(x: number): number;
|
||||
export function signum(x: number): number;
|
||||
export function quot(x: number): (y: number) => number;
|
||||
export function quot(x: number, y: number): number;
|
||||
export function rem(x: number): (y: number) => number;
|
||||
export function rem(x: number, y: number): number;
|
||||
export function div(x: number): (y: number) => number;
|
||||
export function div(x: number, y: number): number;
|
||||
export function mod(x: number): (y: number) => number;
|
||||
export function mod(x: number, y: number): number;
|
||||
export function recip(x: number): number;
|
||||
export var pi: number;
|
||||
export var tau: number;
|
||||
export function exp(x: number): number;
|
||||
export function sqrt(x: number): number;
|
||||
export function ln(x: number): number;
|
||||
export function pow(x: number): (y: number) => number;
|
||||
export function pow(x: number, y: number): number;
|
||||
export function sin(x: number): number;
|
||||
export function cos(x: number): number;
|
||||
export function tan(x: number): number;
|
||||
export function asin(x: number): number;
|
||||
export function acos(x: number): number;
|
||||
export function atan(x: number): number;
|
||||
export function atan2(x: number, y: number): number;
|
||||
export function truncate(x: number): number;
|
||||
export function round(x: number): number;
|
||||
export function ceiling(x: number): number;
|
||||
export function floor(x: number): number;
|
||||
export function isItNaN(x: number): boolean;
|
||||
export function even(x: number): boolean;
|
||||
export function odd(x: number): boolean;
|
||||
export function gcd(x: number): (y: number) => number;
|
||||
export function gcd(x: number, y: number): number;
|
||||
export function lcm(x: number): (y: number) => number;
|
||||
export function lcm(x: number, y: number): number;
|
||||
}
|
||||
|
||||
export = PreludeLS;
|
||||
}
|
||||
Reference in New Issue
Block a user