// Type definitions for prelude.ls 1.1.1 // Project: http://www.preludels.com // Definitions by: Aya Morisawa // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Change [0]: 2015/06/14 - Marcelo Camargo declare namespace PreludeLS { export function id(x: A): A; export function isType(type: string): (x: A) => boolean; export function isType(type: string, x: A): boolean; export function replicate(n: number): (x: A) => A[]; export function replicate(n: number, x: A): A[]; // List export function each(f: (x: A) => void): (xs: A[]) => A[]; export function each(f: (x: A) => void, xs: A[]): A[]; export function map(f: (x: A) => B): (xs: A[]) => B[]; export function map(f: (x: A) => B, xs: A[]): B[]; export function compact(xs: A[]): A[]; export function filter(f: (x: A) => boolean): (xs: A[]) => A[]; export function filter(f: (x: A) => boolean, xs: A[]): A[]; export function reject(f: (x: A) => boolean): (xs: A[]) => A[]; export function reject(f: (x: A) => boolean, xs: A[]): A[]; export function partition(f: (x: A) => Boolean): (xs: A[]) => [A[], A[]]; export function partition(f: (x: A) => Boolean, xs: A[]): [A[], A[]]; export function find(f: (x: A) => Boolean): (xs: A[]) => A; export function find(f: (x: A) => Boolean, xs: A[]): A; export function head(xs: A[]): A; export function tail(xs: A[]): A[]; export function last(xs: A[]): A; export function initial(xs: A[]): A[]; export function empty(xs: A[]): boolean; export function reverse(xs: A[]): A[]; export function unique(xs: A[]): A[]; export function uniqueBy(f: (x: A) => B): (xs: A[]) => A[]; export function uniqueBy(f: (x: A) => B, xs: A[]): A[]; export function fold(f: (x: A) => (y: B) => A): (memo: A) => (xs: B[]) => A; export function fold(f: (x: A) => (y: B) => A, memo: A): (xs: B[]) => A; export function fold(f: (x: A) => (y: B) => A, memo: A, xs: B[]): A; export function foldl(f: (x: A) => (y: B) => A): (memo: A) => (xs: B[]) => A; export function foldl(f: (x: A) => (y: B) => A, memo: A): (xs: B[]) => A; export function foldl(f: (x: A) => (y: B) => A, memo: A, xs: B[]): A; export function fold1(f: (x: A) => (y: A) => A): (xs: A[]) => A; export function fold1(f: (x: A) => (y: A) => A, xs: A[]): A; export function foldl1(f: (x: A) => (y: A) => A): (xs: A[]) => A; export function foldl1(f: (x: A) => (y: A) => A, xs: A[]): A; export function foldr(f: (x: A) => (y: B) => B): (memo: B) => (xs: A[]) => B; export function foldr(f: (x: A) => (y: B) => B, memo: B): (xs: A[]) => B; export function foldr(f: (x: A) => (y: B) => B, memo: B, xs: A[]): B; export function foldr1(f: (x: A) => (y: A) => A): (xs: A[]) => A; export function foldr1(f: (x: A) => (y: A) => A, xs: A[]): A; export function unfoldr(f: (x: B) => ([A, B] | void)): (x: B) => A[]; export function unfoldr(f: (x: B) => ([A, B] | void), x: B): A[]; export function concat(xss: A[][]): A[]; export function concatMap(f: (x: A) => B[]): (xs: A[]) => B[]; export function concatMap(f: (x: A) => B[], xs: A[]): B[]; export function flatten(xs: any[]): any[]; export function difference(...xss: A[][]): A[]; export function intersection(...xss: A[][]): A[]; export function union(...xss: A[][]): A[]; export function countBy(f: (x: A) => B): (xs: A[]) => any; export function countBy(f: (x: A) => B, xs: A[]): any; export function groupBy(f: (x: A) => B): (xs: A[]) => any; export function groupBy(f: (x: A) => B, xs: A[]): any; export function andList(xs: A[]): boolean; export function orList(xs: A[]): boolean; export function any(f: (x: A) => boolean): (xs: A[]) => boolean; export function any(f: (x: A) => boolean, xs: A[]): boolean; export function all(f: (x: A) => boolean): (xs: A[]) => boolean; export function all(f: (x: A) => boolean, xs: A[]): boolean; export function sort(xs: A[]): A[]; export function sortWith(f: (x: A) => (y: A) => number): (xs: A[]) => A[]; export function sortWith(f: (x: A) => (y: A) => number, xs: A[]): A[]; export function sortBy(f: (x: A) => B): (xs: A[]) => A[]; export function sortBy(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(xs: A[]): A; export function minimum(xs: A[]): A; export function maximumBy(f: (x: A) => B): (xs: A[]) => A; export function maximumBy(f: (x: A) => B, xs: A[]): A; export function minimumBy(f: (x: A) => B): (xs: A[]) => A; export function minimumBy(f: (x: A) => B, xs: A[]): A; export function scan(f: (x: A) => (y: B) => A): (memo: A) => (xs: B[]) => A[]; export function scan(f: (x: A) => (y: B) => A, memo: A): (xs: B[]) => A[]; export function scan(f: (x: A) => (y: B) => A, memo: A, xs: B[]): A[]; export function scanl(f: (x: A) => (y: B) => A): (memo: A) => (xs: B[]) => A[]; export function scanl(f: (x: A) => (y: B) => A, memo: A): (xs: B[]) => A[]; export function scanl(f: (x: A) => (y: B) => A, memo: A, xs: B[]): A[]; export function scan1(f: (x: A) => (y: A) => A): (xs: A[]) => A[]; export function scan1(f: (x: A) => (y: A) => A, xs: A[]): A[]; export function scanl1(f: (x: A) => (y: A) => A): (xs: A[]) => A[]; export function scanl1(f: (x: A) => (y: A) => A, xs: A[]): A[]; export function scanr(f: (x: A) => (y: B) => B): (memo: B) => (xs: A[]) => B[]; export function scanr(f: (x: A) => (y: B) => B, memo: B): (xs: A[]) => B[]; export function scanr(f: (x: A) => (y: B) => B, memo: B, xs: A[]): B[]; export function scanr1(f: (x: A) => (y: A) => A): (xs: A[]) => A[]; export function scanr1(f: (x: A) => (y: A) => A, xs: A[]): A[]; export function slice(x: number): (y: number) => (xs: A[]) => A[]; export function slice(x: number, y: number): (xs: A[]) => A[]; export function slice(x: number, y: number, xs: A[]): A[]; export function take(n: number): (xs: A[]) => A[]; export function take(n: number, xs: A[]): A[]; export function drop(n: number): (xs: A[]) => A[]; export function drop(n: number, xs: A[]): A[]; export function splitAt(n: number): (xs: A[]) => [A[], A[]]; export function splitAt(n: number, xs: A[]): [A[], A[]]; export function takeWhile(p: (x: A) => boolean): (xs: A[]) => A[]; export function takeWhile(p: (x: A) => boolean, xs: A[]): A[]; export function dropWhile(p: (x: A) => boolean): (xs: A[]) => A[]; export function dropWhile(p: (x: A) => boolean, xs: A[]): A[]; export function span(p: (x: A) => boolean): (xs: A[]) => [A[], A[]]; export function span(p: (x: A) => boolean, xs: A[]): [A[], A[]]; export function breakList(p: (x: A) => boolean): (xs: A[]) => [A[], A[]]; export function breakList(p: (x: A) => boolean, xs: A[]): [A[], A[]]; export function zip(xs: A[]): (ys: B[]) => [A, B][]; export function zip(xs: A[], ys: B[]): [A, B][]; export function zipWith(f: (x: A) => (y: B) => C): (xs: A[]) => (ys: B[]) => C[]; export function zipWith(f: (x: A) => (y: B) => C, xs: A[]): (ys: B[]) => C[]; export function zipWith(f: (x: A) => (y: B) => C, xs: A[], ys: B[]): C[]; export function zipAll(...xss: A[][]): A[][]; export function zipAllWith(f: (...xs: A[]) => B, ...xss: A[][]): B[]; export function at(n: number): (xs: A[]) => A; export function at(n: number, xs: A[]): A; export function elemIndex(x: A): (xs: A[]) => number; export function elemIndex(x: A, xs: A[]): number; export function elemIndices(x: A): (xs: A[]) => number[]; export function elemIndices(x: A, xs: A[]): number[]; export function findIndex(f: (x: A) => boolean): (xs: A[]) => number; export function findIndex(f: (x: A) => boolean, xs: A[]): number; export function findIndices(f: (x: A) => boolean): (xs: A[]) => number[]; export function findIndices(f: (x: A) => boolean, xs: A[]): number[]; // Obj export function keys(object: { [key: string]: A }): string[]; export function keys(object: { [key: number]: A }): number[]; export function values(object: { [key: string]: A }): A[]; export function values(object: { [key: number]: A }): A[]; export function pairsToObj(object: [string, A][]): { [key: string]: A }; export function pairsToObj(object: [number, A][]): { [key: number]: A }; export function objToPairs(object: { [key: string]: A }): [string, A][]; export function objToPairs(object: { [key: number]: A }): [number, A][]; export function listsToObj(keys: string[]): (values: A[]) => { [key: string]: A }; export function listsToObj(keys: string[], values: A[]): { [key: string]: A }; export function listsToObj(keys: number[]): (values: A[]) => { [key: number]: A }; export function listsToObj(keys: number[], values: A[]): { [key: number]: A }; export function objToLists(object: { [key: string]: A }): [string[], A[]]; export function objToLists(object: { [key: number]: A }): [number[], A[]]; export function empty(object: any): boolean; export function each(f: (x: A) => void): (object: { [key: string]: A }) => { [key: string]: A }; export function each(f: (x: A) => void, object: { [key: string]: A }): { [key: string]: A }; export function each(f: (x: A) => void): (object: { [key: number]: A }) => { [key: number]: A }; export function each(f: (x: A) => void, object: { [key: number]: A }): { [key: number]: A }; export function map(f: (x: A) => B): (object: { [key: string]: A }) => { [key: string]: B }; export function map(f: (x: A) => B, object: { [key: string]: A }): { [key: string]: B }; export function map(f: (x: A) => B): (object: { [key: number]: A }) => { [key: number]: B }; export function map(f: (x: A) => B, object: { [key: number]: A }): { [key: number]: B }; export function compact(object: { [key: string]: A }): { [key: string]: A }; export function compact(object: { [key: number]: A }): { [key: number]: A }; export function filter(f: (x: A) => boolean): (object: { [key: string]: A }) => { [key: string]: A }; export function filter(f: (x: A) => boolean, object: { [key: string]: A }): { [key: string]: A }; export function filter(f: (x: A) => boolean): (object: { [key: number]: A }) => { [key: number]: A }; export function filter(f: (x: A) => boolean, object: { [key: number]: A }): { [key: number]: A }; export function reject(f: (x: A) => boolean): (object: { [key: string]: A }) => { [key: string]: A }; export function reject(f: (x: A) => boolean, object: { [key: string]: A }): { [key: string]: A }; export function reject(f: (x: A) => boolean): (object: { [key: number]: A }) => { [key: number]: A }; export function reject(f: (x: A) => boolean, object: { [key: number]: A }): { [key: number]: A }; export function partition(f: (x: A) => boolean): (object: { [key: string]: A }) => [{ [key: string]: A }, { [key: string]: A }]; export function partition(f: (x: A) => boolean, object: { [key: string]: A }): [{ [key: string]: A }, { [key: string]: A }]; export function partition(f: (x: A) => boolean): (object: { [key: number]: A }) => [{ [key: number]: A }, { [key: number]: A }]; export function partition(f: (x: A) => boolean, object: { [key: number]: A }): [{ [key: number]: A }, { [key: number]: A }]; export function find(f: (x: A) => boolean): (object: { [key: string]: A }) => A; export function find(f: (x: A) => boolean, object: { [key: string]: A }): A; export function find(f: (x: A) => boolean): (object: { [key: number]: A }) => A; export function find(f: (x: A) => boolean, object: { [key: number]: A }): A; export module Obj { export function empty(object: any): boolean; export function each(f: (x: A) => void): (object: { [key: string]: A }) => { [key: string]: A }; export function each(f: (x: A) => void, object: { [key: string]: A }): { [key: string]: A }; export function each(f: (x: A) => void): (object: { [key: number]: A }) => { [key: number]: A }; export function each(f: (x: A) => void, object: { [key: number]: A }): { [key: number]: A }; export function map(f: (x: A) => B): (object: { [key: string]: A }) => { [key: string]: B }; export function map(f: (x: A) => B, object: { [key: string]: A }): { [key: string]: B }; export function map(f: (x: A) => B): (object: { [key: number]: A }) => { [key: number]: B }; export function map(f: (x: A) => B, object: { [key: number]: A }): { [key: number]: B }; export function compact(object: { [key: string]: A }): { [key: string]: A }; export function compact(object: { [key: number]: A }): { [key: number]: A }; export function filter(f: (x: A) => boolean): (object: { [key: string]: A }) => { [key: string]: A }; export function filter(f: (x: A) => boolean, object: { [key: string]: A }): { [key: string]: A }; export function filter(f: (x: A) => boolean): (object: { [key: number]: A }) => { [key: number]: A }; export function filter(f: (x: A) => boolean, object: { [key: number]: A }): { [key: number]: A }; export function reject(f: (x: A) => boolean): (object: { [key: string]: A }) => { [key: string]: A }; export function reject(f: (x: A) => boolean, object: { [key: string]: A }): { [key: string]: A }; export function reject(f: (x: A) => boolean): (object: { [key: number]: A }) => { [key: number]: A }; export function reject(f: (x: A) => boolean, object: { [key: number]: A }): { [key: number]: A }; export function partition(f: (x: A) => boolean): (object: { [key: string]: A }) => [{ [key: string]: A }, { [key: string]: A }]; export function partition(f: (x: A) => boolean, object: { [key: string]: A }): [{ [key: string]: A }, { [key: string]: A }]; export function partition(f: (x: A) => boolean): (object: { [key: number]: A }) => [{ [key: number]: A }, { [key: number]: A }]; export function partition(f: (x: A) => boolean, object: { [key: number]: A }): [{ [key: number]: A }, { [key: number]: A }]; export function find(f: (x: A) => boolean): (object: { [key: string]: A }) => A; export function find(f: (x: A) => boolean, object: { [key: string]: A }): A; export function find(f: (x: A) => boolean): (object: { [key: number]: A }) => A; export function find(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(f: (...args: A[]) => B): (args: A[]) => B; export function apply(f: (...args: A[]) => B, args: A[]): B; export function curry(f: Function): Function; export function flip(f: (x: A) => (y: B) => C): (y: B) => (x: A) => C; export function flip(f: (x: A) => (y: B) => C, y: B): (x: A) => C; export function flip(f: (x: A) => (y: B) => C, y: B, x: A): C; export function fix(f: Function): Function; export function over(f: (x: B) => (y: B) => C | ((x: B, y: B) => C), g: (x: A) => B, x: A, y: A): C; export function over(f: (x: B, y: B) => C | ((x: B) => (y: B) => C), g: (x: A) => B, x: A): (y: A) => C; export function over(f: (x: B, y: B) => C, g: (x: A) => B): (x: A, y: A) => C; export function over(f: (x: B) => (y: B) => C, g: (x: A) => B): (x: A) => (y: A) => C; export function over(f: (x: B, y: B) => C): (g: (x: A) => B) => (x: A, y: A) => C; export function over(f: (x: B) => (y: B) => C): (g: (x: A) => B) => (x: A) => (y: A) => C; // Num export function max(x: Comparable): (y: Comparable) => Comparable; export function max(x: Comparable, y: Comparable): Comparable; export function min(x: Comparable): (y: Comparable) => Comparable; export function min(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;