Identity overview
Added in v2.0.0
Table of contents
- Extract
- combinators
- constructors
- do notation
- error handling
- folding
- instances
- legacy
- mapping
- model
- sequencing
- traversing
- type lambdas
- utils
- zone of death
Extract
extract
Signature
export declare const extract: <A>(wa: A) => A
Added in v2.6.2
combinators
tap
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 tap: { <A, _>(self: A, f: (a: A) => _): A; <A, _>(f: (a: A) => _): (self: A) => A }
Added in v2.16.7
constructors
of
Signature
export declare const of: <A>(a: A) => A
Added in v2.0.0
do notation
Do
Signature
export declare const Do: {}
Added in v2.9.0
apS
Signature
export declare const apS: <N, A, B>(
name: Exclude<N, keyof A>,
fb: B
) => (fa: A) => { readonly [K in N | keyof A]: K extends keyof A ? A[K] : B }
Added in v2.8.0
bind
Signature
export declare const bind: <N, 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 }
Added in v2.8.0
bindTo
Signature
export declare const bindTo: <N>(name: N) => <A>(fa: A) => { readonly [K in N]: A }
Added in v2.8.0
let
Signature
export declare const let: <N, 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 }
Added in v2.13.0
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: () => A) => (fa: A) => A
Added in v2.0.0
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: () => B) => <A>(fa: A) => B | A
Added in v2.9.0
folding
foldMap
Signature
export declare const foldMap: <M>(M: Monoid<M>) => <A>(f: (a: A) => M) => (fa: A) => M
Added in v2.0.0
reduce
Signature
export declare const reduce: <A, B>(b: B, f: (b: B, a: A) => B) => (fa: A) => B
Added in v2.0.0
reduceRight
Signature
export declare const reduceRight: <A, B>(b: B, f: (a: A, b: B) => B) => (fa: A) => B
Added in v2.0.0
instances
Alt
Signature
export declare const Alt: Alt1<'Identity'>
Added in v2.7.0
Applicative
Signature
export declare const Applicative: Applicative1<'Identity'>
Added in v2.7.0
Apply
Signature
export declare const Apply: Apply1<'Identity'>
Added in v2.10.0
Chain
Signature
export declare const Chain: Chain1<'Identity'>
Added in v2.10.0
ChainRec
Signature
export declare const ChainRec: ChainRec1<'Identity'>
Added in v2.7.0
Comonad
Signature
export declare const Comonad: Comonad1<'Identity'>
Added in v2.7.0
Foldable
Signature
export declare const Foldable: Foldable1<'Identity'>
Added in v2.7.0
Functor
Signature
export declare const Functor: Functor1<'Identity'>
Added in v2.7.0
Monad
Signature
export declare const Monad: Monad1<'Identity'>
Added in v2.7.0
Pointed
Signature
export declare const Pointed: Pointed1<'Identity'>
Added in v2.10.0
Traversable
Signature
export declare const Traversable: Traversable1<'Identity'>
Added in v2.7.0
getEq
Signature
export declare const getEq: <A>(E: Eq<A>) => Eq<A>
Added in v2.0.0
getShow
Signature
export declare const getShow: <A>(S: Show<A>) => Show<A>
Added in v2.0.0
legacy
chain
Alias of flatMap
.
Signature
export declare const chain: <A, B>(f: (a: A) => B) => (ma: A) => B
Added in v2.0.0
chainFirst
Alias of tap
Signature
export declare const chainFirst: <A, B>(f: (a: A) => B) => (first: A) => A
Added in v2.0.0
mapping
flap
Signature
export declare const flap: <A>(a: A) => <B>(fab: (a: A) => B) => B
Added in v2.10.0
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: A) => B
Added in v2.0.0
model
Identity (type alias)
Signature
export type Identity<A> = A
Added in v2.0.0
sequencing
flatMap
Signature
export declare const flatMap: { <A, B>(f: (a: A) => B): (ma: A) => B; <A, B>(ma: A, f: (a: A) => B): B }
Added in v2.14.0
flatten
Signature
export declare const flatten: <A>(mma: A) => A
Added in v2.0.0
traversing
sequence
Signature
export declare const sequence: Sequence1<'Identity'>
Added in v2.6.3
traverse
Signature
export declare const traverse: PipeableTraverse1<'Identity'>
Added in v2.6.3
type lambdas
URI
Signature
export declare const URI: 'Identity'
Added in v2.0.0
URI (type alias)
Signature
export type URI = typeof URI
Added in v2.0.0
utils
ap
Signature
export declare const ap: <A>(fa: A) => <B>(fab: (a: A) => B) => B
Added in v2.0.0
apFirst
Combine two effectful actions, keeping only the result of the first.
Signature
export declare const apFirst: <B>(second: B) => <A>(first: A) => A
Added in v2.0.0
apSecond
Combine two effectful actions, keeping only the result of the second.
Signature
export declare const apSecond: <B>(second: B) => <A>(first: A) => B
Added in v2.0.0
duplicate
Signature
export declare const duplicate: <A>(ma: A) => A
Added in v2.0.0
extend
Signature
export declare const extend: <A, B>(f: (wa: A) => B) => (wa: A) => B
Added in v2.0.0
zone of death
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<'Identity'> &
Foldable1<'Identity'> &
Traversable1<'Identity'> &
Alt1<'Identity'> &
Comonad1<'Identity'> &
ChainRec1<'Identity'>
Added in v2.0.0