Skip to main content

Identity

Instances​

Constructors​

Do notation​

Error handling​

Extract​

Folding​

Instance Methods​

Legacy​

Mapping​

Model​

Sequencing​

Traversing​

Type lambdas​

Utilities​

Instances​

Alt​

Signature​

export declare const Alt: Alt1<URI>

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

Applicative​

Signature​

export declare const Applicative: Applicative1<URI>

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

Apply​

Signature​

export declare const Apply: Apply1<URI>

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

Chain​

Signature​

export declare const Chain: Chain1<URI>

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

ChainRec​

Signature​

export declare const ChainRec: ChainRec1<URI>

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

Comonad​

Signature​

export declare const Comonad: Comonad1<URI>

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

Foldable​

Signature​

export declare const Foldable: Foldable1<URI>

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

Functor​

Signature​

export declare const Functor: Functor1<URI>

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

Monad​

Signature​

export declare const Monad: Monad1<URI>

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

Pointed​

Signature​

export declare const Pointed: Pointed1<URI>

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

Traversable​

Signature​

export declare const Traversable: Traversable1<URI>

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

getEq​

Signature​

export declare const getEq: <A>(E: Eq<A>) => Eq<Identity<A>>

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

getShow​

Signature​

export declare const getShow: <A>(S: Show<A>) => Show<Identity<A>>

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

Constructors​

of​

Signature​

export declare const of: <A>(a: A) => Identity<A>

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

Do notation​

Do​

Signature​

export declare const Do: Identity<{}>

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

apS​

Signature​

export declare const apS: <N extends string, A, B>(
name: Exclude<N, keyof A>,
fb: B,
) => (fa: A) => { readonly [K in N | keyof A]: K extends keyof A ? A[K] : B }

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

bind​

Signature​

export declare const bind: <N extends string, A, B>(
name: Exclude<N, keyof A>,
f: (a: A) => B,
) => (ma: A) => { readonly [K in N | keyof A]: K extends keyof A ? A[K] : B }

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

bindTo​

Signature​

export declare const bindTo: <N extends string>(name: N) => <A>(fa: A) => { readonly [K in N]: A }

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

Error handling​

alt​

Identifies an associative operation on a type constructor. It is similar to Semigroup, except that it applies to types of kind * -> *.

Signature​

export declare const alt: <A>(that: () => Identity<A>) => (fa: Identity<A>) => Identity<A>

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

altW​

Less strict version of alt.

The W suffix (short for Widening) means that the return types will be merged.

Signature​

export declare const altW: <B>(that: () => Identity<B>) => <A>(fa: Identity<A>) => Identity<A | B>

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

Extract​

extract​

Signature​

export declare const extract: <A>(wa: Identity<A>) => A

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

Folding​

foldMap​

Signature​

export declare const foldMap: <M>(M: Monoid<M>) => <A>(f: (a: A) => M) => (fa: Identity<A>) => M

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

reduce​

Signature​

export declare const reduce: <A, B>(b: B, f: (b: B, a: A) => B) => (fa: Identity<A>) => B

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

reduceRight​

Signature​

export declare const reduceRight: <A, B>(b: B, f: (a: A, b: B) => B) => (fa: Identity<A>) => B

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

Instance Methods​

chainRec​

Signature​

export declare const chainRec: ChainRec1<URI>['chainRec']

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

Legacy​

chain​

Alias of flatMap.

Signature​

export declare const chain: <A, B>(f: (a: A) => Identity<B>) => (ma: Identity<A>) => Identity<B>

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

Mapping​

flap​

Signature​

export declare const flap: <A>(a: A) => <B>(fab: (a: A) => B) => B

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

map​

map can be used to turn functions (a: A) => B into functions (fa: F<A>) => F<B> whose argument and return types use the type constructor F to represent some computational context.

Signature​

export declare const map: <A, B>(f: (a: A) => B) => (fa: Identity<A>) => Identity<B>

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

Model​

Identity​

Signature​

export type Identity<A> = A

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

Sequencing​

chainFirst​

Composes computations in sequence, using the return value of one computation to determine the next computation and keeping only the result of the first.

Signature​

export declare const chainFirst: <A, B>(f: (a: A) => B) => (first: A) => A

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

flatMap​

Signature​

export declare const flatMap: {
<A, B>(f: (a: A) => Identity<B>): (ma: Identity<A>) => Identity<B>
<A, B>(ma: Identity<A>, f: (a: A) => Identity<B>): Identity<B>
}

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

flatten​

Signature​

export declare const flatten: <A>(mma: Identity<Identity<A>>) => Identity<A>

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

Traversing​

sequence​

Signature​

export declare const sequence: Traversable1<URI>['sequence']

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

traverse​

Signature​

export declare const traverse: PipeableTraverse1<URI>

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

Type lambdas​

URI​

Signature​

export type URI = typeof URI

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

URI​

Signature​

export declare const URI = 'Identity'

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

Utilities​

ap​

Signature​

export declare const ap: <A>(fa: Identity<A>) => <B>(fab: Identity<(a: A) => B>) => Identity<B>

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

apFirst​

Combine two effectful actions, keeping only the result of the first.

Signature​

export declare const apFirst: <B>(second: B) => <A>(first: A) => A

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

apSecond​

Combine two effectful actions, keeping only the result of the second.

Signature​

export declare const apSecond: <B>(second: B) => <A>(first: A) => B

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

duplicate​

Signature​

export declare const duplicate: <A>(ma: Identity<A>) => Identity<Identity<A>>

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

extend​

Signature​

export declare const extend: <A, B>(f: (wa: Identity<A>) => B) => (wa: Identity<A>) => Identity<B>

Details​

  • Added in 0.1.0

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

identity​

This instance is deprecated, use small, specific instances instead. For example if a function needs a Functor instance, pass I.Functor instead of I.identity (where I is from import I from 'fp-ts/Identity')

Signature​

export declare const identity: Monad1<URI> &
Foldable1<URI> &
Traversable1<URI> &
Alt1<URI> &
Comonad1<URI> &
ChainRec1<URI>

Details​

  • Added in 0.1.0
  • Deprecated

License​

  • MIT – Copyright (c) 2017-present Giulio Canti

let​

Signature​

export declare const let_: <N extends string, A, B>(
name: Exclude<N, keyof A>,
f: (a: A) => B,
) => (fa: A) => { readonly [K in N | keyof A]: K extends keyof A ? A[K] : B }