declare var S: Sanctuary.Environment; export = S; export as namespace S; type Nullable = A | null; interface Pair { "@@type": "sanctuary/Pair"; } type Thunk = () => A; type Fn = (a: A) => B; type Fn2 = (a: A) => (b: B) => C; type Fn3 = (a: A) => (b: B) => (c: C) => D; type Fn4 = (a: A) => (b: B) => (c: C) => (d: D) => E; type Fn5 = (a: A) => (b: B) => (c: C) => (d: D) => (e: E) => F; type Fn2_ = (a: A, b: B) => C; type Fn3_ = (a: A, b: B, c: C) => D; type Fn4_ = (a: A, b: B, c: C, d: D) => E; type Fn5_ = (a: A, b: B, c: C, d: D, e: E) => F; type Predicate = (a: A) => boolean; interface StrMap { [k: string]: A; } interface Maybe { "@@type": "sanctuary/Maybe"; } interface Either { "@@type": "sanctuary/Either"; } type ValidNumber = number; type FiniteNumber = number; type NonZeroFiniteNumber = number; type Integer = number; type NonNegativeInteger = number; interface TypeRep {} // Please retain type-class hierarchy ordering // https://github.com/sanctuary-js/sanctuary-type-classes#type-class-hierarchy interface Setoid {} interface Ord extends Setoid {} interface Semigroupoid {} interface Category extends Semigroupoid {} interface Semigroup {} interface Monoid extends Semigroup {} interface Group extends Monoid {} interface Functor {} interface Bifunctor extends Functor {} interface Profunctor extends Functor {} interface Apply extends Functor {} interface Applicative extends Apply {} interface Chain extends Apply {} interface ChainRec extends Chain {} interface Monad extends Applicative, Chain {} interface Alt extends Functor {} interface Plus extends Alt {} interface Alternative extends Applicative, Plus {} interface Foldable {} interface Traversable extends Functor, Foldable {} interface Extend extends Functor {} interface Comonad extends Extend {} interface Contravariant {} interface ListToMaybeList { (xs: string): Maybe; (xs: readonly A[]): Maybe; } interface MatchObj { match: string; groups: ReadonlyArray>; } declare namespace Sanctuary { interface Static { Maybe: TypeRep; Nothing: Maybe; Just(x: A): Maybe; Either: TypeRep; Left(x: A): Either; Right(x: A): Either; // Classify type(x: any): { namespace: Maybe; name: string; version: NonNegativeInteger; }; is(typeRep: TypeRep): (x: any) => boolean; // Showable show(x: any): string; // Fantasy Land equals(x: A): (y: A) => boolean; lt(x: A): (y: A) => boolean; lte(x: A): (y: A) => boolean; gt(x: A): (y: A) => boolean; gte(x: A): (y: A) => boolean; min(x: A): (y: A) => A; max(x: A): (y: A) => A; clamp(x: A): (y: A) => (z: A) => A; id(p: TypeRep): Fn | Category; concat(x: Semigroup): (y: Semigroup) => Semigroup; concat(x: readonly A[]): (y: readonly A[]) => A[]; concat(x: StrMap): (y: StrMap) => StrMap; concat(x: string): (y: string) => string; empty(p: TypeRep): Monoid; invert(g: Group): Group; map(p: Fn): { (q: Fn): Fn; (q: readonly A[]): B[]; (q: StrMap): StrMap; (q: Functor): Functor; }; bimap(p: Fn): (q: Fn) => (r: Bifunctor) => Bifunctor; mapLeft(p: Fn): { (q: Pair): Pair; (q: Either): Either; (q: Bifunctor): Bifunctor; }; promap(p: Fn): (q: Fn) => { (r: Fn): Fn; (r: Profunctor): Profunctor; }; alt(x: A): (y: A) => A; zero(p: TypeRep): Plus; reduce( p: Fn2, ): (q: B) => (r: readonly A[] | StrMap | Maybe | Either | Foldable) => B; reduce_( p: Fn2, ): (q: B) => (r: readonly A[] | StrMap | Maybe | Either | Foldable) => B; traverse( typeRep: TypeRep, ): (f: Fn>) => (traversable: Traversable) => Applicative>; sequence(typeRep: TypeRep): (traversable: Traversable>) => Applicative>; ap(p: Apply>): (q: Apply) => Apply; lift2(f: Fn2): { (x: Fn): (y: Fn) => Fn; (x: Apply): (y: Apply) => Apply; }; lift3(f: Fn3): { (x: Fn): (y: Fn) => (z: Fn) => Fn; (x: Apply): (y: Apply) => (z: Apply) => Apply; }; apFirst(x: Apply): (y: Apply) => Apply; apSecond(x: Apply): (y: Apply) => Apply; of(typeRep: TypeRep): (x: A) => Fn; of(typeRep: TypeRep): (x: A) => Applicative; chain(f: Fn2): (chain_: Fn) => Fn; chain(f: Fn>): (chain_: Chain) => Chain; join(chain_: Fn2): Fn; join(chain_: ReadonlyArray): A[]; join(chain_: Maybe>): Maybe; join(chain_: Chain>): Chain; chainRec(typeRep: TypeRep): { (f: Fn2>): (x: A) => Fn; (f: Fn>>): (x: A) => ChainRec; }; extend(f: Fn, B>): (extend_: Extend) => Extend; duplicate(comonad: readonly A[]): ReadonlyArray; duplicate(comonad: Maybe): Maybe>; duplicate(comonad: Pair): Pair>; duplicate(comonad: Comonad): Comonad>; extract(comonad: Comonad): A; contramap(f: Fn): { (contravariant: Fn): Fn; (contravariant: Contravariant): Contravariant; }; filter(pred: Predicate): { (m: readonly A[]): A[]; (m: Foldable): Foldable; }; reject(pred: Predicate): { (m: readonly A[]): A[]; (m: Foldable): Foldable; }; reject(pred: Predicate): { (m: readonly A[]): A[]; (m: Foldable): Foldable; }; takeWhile(pred: Predicate): (foldable: Foldable) => Foldable; dropWhile(pred: Predicate): (foldable: Foldable) => Foldable; // Combinator I(x: A): A; K(x: A): (y: any) => A; T(x: A): (f: Fn) => B; // Pair Pair(a: A): (b: B) => Pair; pair(f: Fn2): (p: Pair) => C; fst(p: Pair): A; snd(p: Pair): B; swap(p: Pair): Pair; // Function curry2(f: Fn2_): Fn2; curry3(f: Fn3_): Fn3; curry4(f: Fn4_): Fn4; curry5(f: Fn5_): Fn5; flip(f: Fn2): Fn2; // Composition compose(f: Fn): (g: Fn) => Fn; compose(x: Semigroupoid): (y: Semigroupoid) => Semigroupoid; pipe(fs: [Fn]): (x: A) => B; pipe(fs: [Fn, Fn]): (x: A) => C; pipe(fs: [Fn, Fn, Fn]): (x: A) => D; pipe(fs: [Fn, Fn, Fn, Fn]): (x: A) => E; pipe(fs: [Fn, Fn, Fn, Fn, Fn]): (x: A) => F; pipe(fs: ReadonlyArray>): (x: any) => any; pipeK(fs: ReadonlyArray>>): (chain_: Chain) => Chain; on(p: Fn2): (q: Fn) => (r: A) => Fn; // Maybe isNothing(p: Maybe): boolean; isJust(p: Maybe): boolean; fromMaybe(p: A): (q: Maybe) => A; fromMaybe_(p: Thunk): (q: Maybe) => A; maybeToNullable(p: Maybe): Nullable; maybe(p: B): (q: Fn) => (r: Maybe) => B; maybe_(p: Thunk): (q: Fn) => (r: Maybe) => B; justs(p: ReadonlyArray>): A[]; mapMaybe(p: Fn>): (q: A[]) => A[]; maybeToEither(p: A): (q: Maybe) => Either; // Either isLeft(p: Either): boolean; isRight(p: Either): boolean; fromLeft(p: A): (q: Either) => A; fromRight(p: B): (q: Either) => B; fromEither(p: B): (q: Either) => B; either(p: Fn): (q: Fn) => (r: Either) => C; lefts(p: ReadonlyArray>): A[]; rights(p: ReadonlyArray>): B[]; tagBy(p: Predicate): (q: A) => Either; encase(throwing: Fn): (a: A) => Either; eitherToMaybe(p: Either): Maybe; // Logic and(p: boolean): (q: boolean) => boolean; or(p: boolean): (q: boolean) => boolean; not(p: boolean): boolean; complement(p: Predicate): Predicate; boolean(p: A): (q: A) => (b: boolean) => A; ifElse(p: Predicate): (q: Fn) => (r: Fn) => Fn; when(p: Predicate): (q: Fn) => Fn; unless(p: Predicate): (q: Fn) => Fn; // List array(p: B): (q: Fn2) => (r: readonly A[]) => B; head(xs: string): Maybe; head(xs: readonly A[]): Maybe; last(xs: string): Maybe; last(xs: readonly A[]): Maybe; tail(xs: string): Maybe; tail(xs: readonly A[]): Maybe; init(xs: string): Maybe; init(xs: readonly A[]): Maybe; take(n: Integer): ListToMaybeList; takeLast(n: Integer): ListToMaybeList; drop(n: Integer): ListToMaybeList; dropLast(n: Integer): ListToMaybeList; size(xs: Foldable | readonly A[]): Integer; // Array // TODO: Fantasyland overloads, non-curried versions append(x: A): { (xs: readonly A[]): A[]; (xs: Applicative): Applicative; }; prepend(x: A): { (xs: readonly A[]): A[]; (xs: Applicative): Applicative; }; joinWith(p: string): (q: readonly string[]) => string; elem(p: A): (q: Foldable | StrMap | readonly A[]) => boolean; find(p: Predicate): (q: readonly A[] | StrMap | Foldable) => Maybe; intercalate(p: A): (q: Foldable) => A; foldMap(t: TypeRep): (f: Fn) => (g: Foldable) => M; unfoldr(f: Fn>>): (x: B) => A[]; range(from: Integer): (to: Integer) => Integer[]; groupBy(f: Fn2): (xs: readonly A[]) => A[][]; reverse(foldable: readonly A[]): A[]; reverse(foldable: Foldable): Foldable; sort(foldable: readonly A[]): A[]; sort(foldable: Foldable): Foldable; sortBy(f: Fn>): { (foldable: readonly A[]): A[]; (foldable: Foldable): Foldable; }; zip(p: readonly A[]): (q: readonly B[]) => ReadonlyArray>; zipWith(f: Fn2): (p: readonly A[]) => (q: readonly B[]) => readonly C[]; all(p: Predicate): (q: Foldable) => boolean; any(p: Predicate): (q: Foldable) => boolean; none(p: Predicate): (q: Foldable) => boolean; // Object prop(p: string): (q: any) => any; props(p: readonly string[]): (q: any) => any; get(p: Predicate): (q: string) => (r: any) => Maybe; gets(p: Predicate): (q: readonly string[]) => (r: any) => Maybe; // StrMap value(p: string): (p: StrMap) => Maybe; singleton(key: string): (value: A) => StrMap; insert(key: string): (value: A) => (r: StrMap) => StrMap; remove(key: string): (r: StrMap) => StrMap; keys(p: StrMap): string[]; values(p: StrMap): A[]; pairs(p: StrMap): Array>; fromPairs(p: Foldable>): StrMap; // Number negate(n: ValidNumber): ValidNumber; add(p: FiniteNumber): (q: FiniteNumber) => FiniteNumber; sum(p: Foldable | readonly FiniteNumber[]): FiniteNumber; sub(p: FiniteNumber): (q: FiniteNumber) => FiniteNumber; mult(x: FiniteNumber): (q: FiniteNumber) => FiniteNumber; product(p: Foldable | readonly FiniteNumber[]): FiniteNumber; div(p: NonZeroFiniteNumber): (q: FiniteNumber) => FiniteNumber; pow(p: FiniteNumber): (q: FiniteNumber) => FiniteNumber; mean(p: Foldable | readonly FiniteNumber[]): Maybe; // Integer even(n: Integer): boolean; odd(n: Integer): boolean; // Parse parseDate(s: string): Maybe; parseFloat(s: string): Maybe; parseInt(p: Integer): (q: string) => Maybe; parseJson(p: Predicate): (q: string) => Maybe; // RegExp regex(p: string): (q: string) => RegExp; regexEscape(s: string): string; test(pattern: RegExp): Predicate; match(pattern: RegExp): (q: string) => Array>; matchAll(pattern: RegExp): (q: string) => MatchObj[]; // String toUpper(s: string): string; toLower(s: string): string; trim(s: string): string; stripPrefix(prefix: string): (q: string) => Maybe; stripSuffix(suffix: string): (q: string) => Maybe; words(s: string): string[]; unwords(xs: readonly string[]): string; lines(s: string): string[]; unlines(xs: readonly string[]): string; splitOn(separator: string): (q: string) => string[]; splitOnRegex(pattern: RegExp): (q: string) => string[]; } interface Environment extends Static { env: readonly any[]; create(opts: { checkTypes: boolean; env: readonly any[] }): Static; unchecked: Static; } }