Table of contents


URI (type alias)

Signature

export type URI = typeof URI

Identity (class)

Signature

export class Identity<A> {
  constructor(readonly value: A) { ... }
  ...
}

Added in v1.0.0

map (method)

Signature

map<B>(f: (a: A) => B): Identity<B> { ... }

ap (method)

Signature

ap<B>(fab: Identity<(a: A) => B>): Identity<B> { ... }

ap_ (method)

Flipped version of ap

Signature

ap_<B, C>(this: Identity<(b: B) => C>, fb: Identity<B>): Identity<C> { ... }

chain (method)

Signature

chain<B>(f: (a: A) => Identity<B>): Identity<B> { ... }

reduce (method)

Signature

reduce<B>(b: B, f: (b: B, a: A) => B): B { ... }

alt (method)

Signature

alt(fx: Identity<A>): Identity<A> { ... }

orElse (method)

Lazy version of alt

Signature

orElse(fx: Lazy<Identity<A>>): Identity<A> { ... }

Example

import { Identity } from 'fp-ts/lib/Identity'

const a = new Identity(1)
assert.deepStrictEqual(a.orElse(() => new Identity(2)), a)

Added in v1.6.0

extract (method)

Signature

extract(): A { ... }

extend (method)

Signature

extend<B>(f: (ea: Identity<A>) => B): Identity<B> { ... }

fold (method)

Signature

fold<B>(f: (a: A) => B): B { ... }

inspect (method)

Signature

inspect(): string { ... }

toString (method)

Signature

toString(): string { ... }

URI (constant)

Signature

export const URI = ...

identity (constant)

Signature

export const identity: Monad1<URI> &
  Foldable2v1<URI> &
  Traversable2v1<URI> &
  Alt1<URI> &
  Comonad1<URI> &
  ChainRec1<URI> = ...

Added in v1.0.0

getSetoid (function)

Signature

export const getSetoid = <A>(setoid: Setoid<A>): Setoid<Identity<A>> => ...

Added in v1.0.0