|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570 |
- /**
- * @since 2.0.0
- */
- import { BooleanAlgebra } from './BooleanAlgebra'
- import { Monoid } from './Monoid'
- import { Ring } from './Ring'
- import { Semigroup } from './Semigroup'
- import { Semiring } from './Semiring'
- /**
- * @category instances
- * @since 2.10.0
- */
- export declare const getBooleanAlgebra: <B>(B: BooleanAlgebra<B>) => <A = never>() => BooleanAlgebra<(a: A) => B>
- /**
- * Unary functions form a semigroup as long as you can provide a semigroup for the codomain.
- *
- * @example
- * import { Predicate, getSemigroup } from 'fp-ts/function'
- * import * as B from 'fp-ts/boolean'
- *
- * const f: Predicate<number> = (n) => n <= 2
- * const g: Predicate<number> = (n) => n >= 0
- *
- * const S1 = getSemigroup(B.SemigroupAll)<number>()
- *
- * assert.deepStrictEqual(S1.concat(f, g)(1), true)
- * assert.deepStrictEqual(S1.concat(f, g)(3), false)
- *
- * const S2 = getSemigroup(B.SemigroupAny)<number>()
- *
- * assert.deepStrictEqual(S2.concat(f, g)(1), true)
- * assert.deepStrictEqual(S2.concat(f, g)(3), true)
- *
- * @category instances
- * @since 2.10.0
- */
- export declare const getSemigroup: <S>(S: Semigroup<S>) => <A = never>() => Semigroup<(a: A) => S>
- /**
- * Unary functions form a monoid as long as you can provide a monoid for the codomain.
- *
- * @example
- * import { Predicate } from 'fp-ts/Predicate'
- * import { getMonoid } from 'fp-ts/function'
- * import * as B from 'fp-ts/boolean'
- *
- * const f: Predicate<number> = (n) => n <= 2
- * const g: Predicate<number> = (n) => n >= 0
- *
- * const M1 = getMonoid(B.MonoidAll)<number>()
- *
- * assert.deepStrictEqual(M1.concat(f, g)(1), true)
- * assert.deepStrictEqual(M1.concat(f, g)(3), false)
- *
- * const M2 = getMonoid(B.MonoidAny)<number>()
- *
- * assert.deepStrictEqual(M2.concat(f, g)(1), true)
- * assert.deepStrictEqual(M2.concat(f, g)(3), true)
- *
- * @category instances
- * @since 2.10.0
- */
- export declare const getMonoid: <M>(M: Monoid<M>) => <A = never>() => Monoid<(a: A) => M>
- /**
- * @category instances
- * @since 2.10.0
- */
- export declare const getSemiring: <A, B>(S: Semiring<B>) => Semiring<(a: A) => B>
- /**
- * @category instances
- * @since 2.10.0
- */
- export declare const getRing: <A, B>(R: Ring<B>) => Ring<(a: A) => B>
- /**
- * @since 2.11.0
- */
- export declare const apply: <A>(a: A) => <B>(f: (a: A) => B) => B
- /**
- * A *thunk*
- *
- * @since 2.0.0
- */
- export interface Lazy<A> {
- (): A
- }
- /**
- * @example
- * import { FunctionN } from 'fp-ts/function'
- *
- * export const sum: FunctionN<[number, number], number> = (a, b) => a + b
- *
- * @since 2.0.0
- */
- export interface FunctionN<A extends ReadonlyArray<unknown>, B> {
- (...args: A): B
- }
- /**
- * @since 2.0.0
- */
- export declare function identity<A>(a: A): A
- /**
- * @since 2.0.0
- */
- export declare const unsafeCoerce: <A, B>(a: A) => B
- /**
- * @since 2.0.0
- */
- export declare function constant<A>(a: A): Lazy<A>
- /**
- * A thunk that returns always `true`.
- *
- * @since 2.0.0
- */
- export declare const constTrue: Lazy<boolean>
- /**
- * A thunk that returns always `false`.
- *
- * @since 2.0.0
- */
- export declare const constFalse: Lazy<boolean>
- /**
- * A thunk that returns always `null`.
- *
- * @since 2.0.0
- */
- export declare const constNull: Lazy<null>
- /**
- * A thunk that returns always `undefined`.
- *
- * @since 2.0.0
- */
- export declare const constUndefined: Lazy<undefined>
- /**
- * A thunk that returns always `void`.
- *
- * @since 2.0.0
- */
- export declare const constVoid: Lazy<void>
- /**
- * Flips the arguments of a curried function.
- *
- * @example
- * import { flip } from 'fp-ts/function'
- *
- * const f = (a: number) => (b: string) => a - b.length
- *
- * assert.strictEqual(flip(f)('aaa')(2), -1)
- *
- * @since 2.0.0
- */
- export declare function flip<A, B, C>(f: (a: A) => (b: B) => C): (b: B) => (a: A) => C
- /** @deprecated */
- export declare function flip<A, B, C>(f: (a: A, b: B) => C): (b: B, a: A) => C
- /**
- * Performs left-to-right function composition. The first argument may have any arity, the remaining arguments must be unary.
- *
- * See also [`pipe`](#pipe).
- *
- * @example
- * import { flow } from 'fp-ts/function'
- *
- * const len = (s: string): number => s.length
- * const double = (n: number): number => n * 2
- *
- * const f = flow(len, double)
- *
- * assert.strictEqual(f('aaa'), 6)
- *
- * @since 2.0.0
- */
- export declare function flow<A extends ReadonlyArray<unknown>, B>(ab: (...a: A) => B): (...a: A) => B
- export declare function flow<A extends ReadonlyArray<unknown>, B, C>(
- ab: (...a: A) => B,
- bc: (b: B) => C
- ): (...a: A) => C
- export declare function flow<A extends ReadonlyArray<unknown>, B, C, D>(
- ab: (...a: A) => B,
- bc: (b: B) => C,
- cd: (c: C) => D
- ): (...a: A) => D
- export declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E>(
- ab: (...a: A) => B,
- bc: (b: B) => C,
- cd: (c: C) => D,
- de: (d: D) => E
- ): (...a: A) => E
- export declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F>(
- ab: (...a: A) => B,
- bc: (b: B) => C,
- cd: (c: C) => D,
- de: (d: D) => E,
- ef: (e: E) => F
- ): (...a: A) => F
- export declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G>(
- ab: (...a: A) => B,
- bc: (b: B) => C,
- cd: (c: C) => D,
- de: (d: D) => E,
- ef: (e: E) => F,
- fg: (f: F) => G
- ): (...a: A) => G
- export declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H>(
- ab: (...a: A) => B,
- bc: (b: B) => C,
- cd: (c: C) => D,
- de: (d: D) => E,
- ef: (e: E) => F,
- fg: (f: F) => G,
- gh: (g: G) => H
- ): (...a: A) => H
- export declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I>(
- ab: (...a: A) => B,
- bc: (b: B) => C,
- cd: (c: C) => D,
- de: (d: D) => E,
- ef: (e: E) => F,
- fg: (f: F) => G,
- gh: (g: G) => H,
- hi: (h: H) => I
- ): (...a: A) => I
- export declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I, J>(
- ab: (...a: A) => B,
- bc: (b: B) => C,
- cd: (c: C) => D,
- de: (d: D) => E,
- ef: (e: E) => F,
- fg: (f: F) => G,
- gh: (g: G) => H,
- hi: (h: H) => I,
- ij: (i: I) => J
- ): (...a: A) => J
- /**
- * @since 2.0.0
- */
- export declare function tuple<T extends ReadonlyArray<any>>(...t: T): T
- /**
- * @since 2.0.0
- */
- export declare function increment(n: number): number
- /**
- * @since 2.0.0
- */
- export declare function decrement(n: number): number
- /**
- * @since 2.0.0
- */
- export declare function absurd<A>(_: never): A
- /**
- * Creates a tupled version of this function: instead of `n` arguments, it accepts a single tuple argument.
- *
- * @example
- * import { tupled } from 'fp-ts/function'
- *
- * const add = tupled((x: number, y: number): number => x + y)
- *
- * assert.strictEqual(add([1, 2]), 3)
- *
- * @since 2.4.0
- */
- export declare function tupled<A extends ReadonlyArray<unknown>, B>(f: (...a: A) => B): (a: A) => B
- /**
- * Inverse function of `tupled`
- *
- * @since 2.4.0
- */
- export declare function untupled<A extends ReadonlyArray<unknown>, B>(f: (a: A) => B): (...a: A) => B
- /**
- * Pipes the value of an expression into a pipeline of functions.
- *
- * See also [`flow`](#flow).
- *
- * @example
- * import { pipe } from 'fp-ts/function'
- *
- * const len = (s: string): number => s.length
- * const double = (n: number): number => n * 2
- *
- * // without pipe
- * assert.strictEqual(double(len('aaa')), 6)
- *
- * // with pipe
- * assert.strictEqual(pipe('aaa', len, double), 6)
- *
- * @since 2.6.3
- */
- export declare function pipe<A>(a: A): A
- export declare function pipe<A, B>(a: A, ab: (a: A) => B): B
- export declare function pipe<A, B, C>(a: A, ab: (a: A) => B, bc: (b: B) => C): C
- export declare function pipe<A, B, C, D>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D): D
- export declare function pipe<A, B, C, D, E>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E): E
- export declare function pipe<A, B, C, D, E, F>(
- a: A,
- ab: (a: A) => B,
- bc: (b: B) => C,
- cd: (c: C) => D,
- de: (d: D) => E,
- ef: (e: E) => F
- ): F
- export declare function pipe<A, B, C, D, E, F, G>(
- a: A,
- ab: (a: A) => B,
- bc: (b: B) => C,
- cd: (c: C) => D,
- de: (d: D) => E,
- ef: (e: E) => F,
- fg: (f: F) => G
- ): G
- export declare function pipe<A, B, C, D, E, F, G, H>(
- a: A,
- ab: (a: A) => B,
- bc: (b: B) => C,
- cd: (c: C) => D,
- de: (d: D) => E,
- ef: (e: E) => F,
- fg: (f: F) => G,
- gh: (g: G) => H
- ): H
- export declare function pipe<A, B, C, D, E, F, G, H, I>(
- a: A,
- ab: (a: A) => B,
- bc: (b: B) => C,
- cd: (c: C) => D,
- de: (d: D) => E,
- ef: (e: E) => F,
- fg: (f: F) => G,
- gh: (g: G) => H,
- hi: (h: H) => I
- ): I
- export declare function pipe<A, B, C, D, E, F, G, H, I, J>(
- a: A,
- ab: (a: A) => B,
- bc: (b: B) => C,
- cd: (c: C) => D,
- de: (d: D) => E,
- ef: (e: E) => F,
- fg: (f: F) => G,
- gh: (g: G) => H,
- hi: (h: H) => I,
- ij: (i: I) => J
- ): J
- export declare function pipe<A, B, C, D, E, F, G, H, I, J, K>(
- a: A,
- ab: (a: A) => B,
- bc: (b: B) => C,
- cd: (c: C) => D,
- de: (d: D) => E,
- ef: (e: E) => F,
- fg: (f: F) => G,
- gh: (g: G) => H,
- hi: (h: H) => I,
- ij: (i: I) => J,
- jk: (j: J) => K
- ): K
- export declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L>(
- a: A,
- ab: (a: A) => B,
- bc: (b: B) => C,
- cd: (c: C) => D,
- de: (d: D) => E,
- ef: (e: E) => F,
- fg: (f: F) => G,
- gh: (g: G) => H,
- hi: (h: H) => I,
- ij: (i: I) => J,
- jk: (j: J) => K,
- kl: (k: K) => L
- ): L
- export declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M>(
- a: A,
- ab: (a: A) => B,
- bc: (b: B) => C,
- cd: (c: C) => D,
- de: (d: D) => E,
- ef: (e: E) => F,
- fg: (f: F) => G,
- gh: (g: G) => H,
- hi: (h: H) => I,
- ij: (i: I) => J,
- jk: (j: J) => K,
- kl: (k: K) => L,
- lm: (l: L) => M
- ): M
- export declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N>(
- a: A,
- ab: (a: A) => B,
- bc: (b: B) => C,
- cd: (c: C) => D,
- de: (d: D) => E,
- ef: (e: E) => F,
- fg: (f: F) => G,
- gh: (g: G) => H,
- hi: (h: H) => I,
- ij: (i: I) => J,
- jk: (j: J) => K,
- kl: (k: K) => L,
- lm: (l: L) => M,
- mn: (m: M) => N
- ): N
- export declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(
- a: A,
- ab: (a: A) => B,
- bc: (b: B) => C,
- cd: (c: C) => D,
- de: (d: D) => E,
- ef: (e: E) => F,
- fg: (f: F) => G,
- gh: (g: G) => H,
- hi: (h: H) => I,
- ij: (i: I) => J,
- jk: (j: J) => K,
- kl: (k: K) => L,
- lm: (l: L) => M,
- mn: (m: M) => N,
- no: (n: N) => O
- ): O
- export declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P>(
- a: A,
- ab: (a: A) => B,
- bc: (b: B) => C,
- cd: (c: C) => D,
- de: (d: D) => E,
- ef: (e: E) => F,
- fg: (f: F) => G,
- gh: (g: G) => H,
- hi: (h: H) => I,
- ij: (i: I) => J,
- jk: (j: J) => K,
- kl: (k: K) => L,
- lm: (l: L) => M,
- mn: (m: M) => N,
- no: (n: N) => O,
- op: (o: O) => P
- ): P
- export declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q>(
- a: A,
- ab: (a: A) => B,
- bc: (b: B) => C,
- cd: (c: C) => D,
- de: (d: D) => E,
- ef: (e: E) => F,
- fg: (f: F) => G,
- gh: (g: G) => H,
- hi: (h: H) => I,
- ij: (i: I) => J,
- jk: (j: J) => K,
- kl: (k: K) => L,
- lm: (l: L) => M,
- mn: (m: M) => N,
- no: (n: N) => O,
- op: (o: O) => P,
- pq: (p: P) => Q
- ): Q
- export declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R>(
- a: A,
- ab: (a: A) => B,
- bc: (b: B) => C,
- cd: (c: C) => D,
- de: (d: D) => E,
- ef: (e: E) => F,
- fg: (f: F) => G,
- gh: (g: G) => H,
- hi: (h: H) => I,
- ij: (i: I) => J,
- jk: (j: J) => K,
- kl: (k: K) => L,
- lm: (l: L) => M,
- mn: (m: M) => N,
- no: (n: N) => O,
- op: (o: O) => P,
- pq: (p: P) => Q,
- qr: (q: Q) => R
- ): R
- export declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S>(
- a: A,
- ab: (a: A) => B,
- bc: (b: B) => C,
- cd: (c: C) => D,
- de: (d: D) => E,
- ef: (e: E) => F,
- fg: (f: F) => G,
- gh: (g: G) => H,
- hi: (h: H) => I,
- ij: (i: I) => J,
- jk: (j: J) => K,
- kl: (k: K) => L,
- lm: (l: L) => M,
- mn: (m: M) => N,
- no: (n: N) => O,
- op: (o: O) => P,
- pq: (p: P) => Q,
- qr: (q: Q) => R,
- rs: (r: R) => S
- ): S
- export declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T>(
- a: A,
- ab: (a: A) => B,
- bc: (b: B) => C,
- cd: (c: C) => D,
- de: (d: D) => E,
- ef: (e: E) => F,
- fg: (f: F) => G,
- gh: (g: G) => H,
- hi: (h: H) => I,
- ij: (i: I) => J,
- jk: (j: J) => K,
- kl: (k: K) => L,
- lm: (l: L) => M,
- mn: (m: M) => N,
- no: (n: N) => O,
- op: (o: O) => P,
- pq: (p: P) => Q,
- qr: (q: Q) => R,
- rs: (r: R) => S,
- st: (s: S) => T
- ): T
- /**
- * Type hole simulation
- *
- * @since 2.7.0
- */
- export declare const hole: <T>() => T
- /**
- * @since 2.11.0
- */
- export declare const SK: <A, B>(_: A, b: B) => B
- /**
- * Use `Refinement` module instead.
- *
- * @category zone of death
- * @since 2.0.0
- * @deprecated
- */
- export interface Refinement<A, B extends A> {
- (a: A): a is B
- }
- /**
- * Use `Predicate` module instead.
- *
- * @category zone of death
- * @since 2.0.0
- * @deprecated
- */
- export interface Predicate<A> {
- (a: A): boolean
- }
- /**
- * Use `Predicate` module instead.
- *
- * @category zone of death
- * @since 2.0.0
- * @deprecated
- */
- export declare function not<A>(predicate: Predicate<A>): Predicate<A>
- /**
- * Use `Endomorphism` module instead.
- *
- * @category zone of death
- * @since 2.0.0
- * @deprecated
- */
- export interface Endomorphism<A> {
- (a: A): A
- }
- /**
- * Use `Endomorphism` module instead.
- *
- * @category zone of death
- * @since 2.10.0
- * @deprecated
- */
- export declare const getEndomorphismMonoid: <A = never>() => Monoid<Endomorphism<A>>
|