fp-ts

← Back

Source

empty

const empty: Record<string, never>

Added in v1.10.0 (constant)

collect

collect<A, B>(d: Record<string, A>, f: (k: string, a: A) => B): Array<B>

Added in v1.10.0 (function)

compact

<A>(fa: Record<string, Option<A>>): Record<string, A>

Added in v1.10.0 (function)

filterMap

<A, B>(fa: Record<string, A>, f: (a: A) => Option<B>): Record<string, B>

Added in v1.10.0 (function)

filterMapWithIndex

filterMapWithIndex<A, B>(
  fa: Record<string, A>,
  f: (key: string, a: A) => Option<B>
): Record<string, B>

Added in v1.12.0 (function)

filterWithIndex

filterWithIndex<A>(fa: Record<string, A>, p: (key: string, a: A) => boolean): Record<string, A>

Added in v1.12.0 (function)

foldMap

<M>(M: Monoid<M>): (<A>(fa: Record<string, A>, f: (a: A) => M) => M)

Added in v1.10.0 (function)

foldMapWithKey

<M>(M: Monoid<M>) => <A>(fa: Record<string, A>, f: (k: string, a: A) => M): M

Added in v1.12.0 (function)

foldr

<A, B>(fa: Record<string, A>, b: B, f: (a: A, b: B) => B): B

Added in v1.10.0 (function)

foldrWithKey

foldrWithKey<A, B>(fa: Record<string, A>, b: B, f: (k: string, a: A, b: B) => B): B

Added in v1.12.0 (function)

fromFoldable

fromFoldable<F>(
  F: Foldable<F>
): <A>(ta: HKT<F, [string, A]>, f: (existing: A, a: A) => A) => Record<string, A>

Added in v1.10.0 (function)

Create a dictionary from a foldable collection of key/value pairs, using the specified function to combine values for duplicate keys.

getMonoid

getDictionaryMonoid

Added in v1.10.0 (function)

getSetoid

<A>(S: Setoid<A>): Setoid<Record<string, A>>

Added in v1.10.0 (function)

insert

insert<A>(k: string, a: A, d: Record<string, A>): Record<string, A>

Added in v1.10.0 (function)

Insert or replace a key/value pair in a map

isEmpty

<A>(d: Record<string, A>): boolean

Added in v1.10.0 (function)

Test whether a dictionary is empty

isSubdictionary

<A>(S: Setoid<A>) => (d1: Record<string, A>, d2: Record<string, A>): boolean

Added in v1.10.0 (function)

Test whether one dictionary contains all of the keys and values contained in another dictionary

map

map<A, B>(fa: Record<string, A>, f: (a: A) => B): Record<string, B>

Added in v1.10.0 (function)

mapWithKey

mapWithKey<A, B>(fa: Record<string, A>, f: (k: string, a: A) => B): Record<string, B>

Added in v1.10.0 (function)

partition

<A>(
  fa: Record<string, A>,
  p: Predicate<A>
): Separated<Record<string, A>, Record<string, A>>

Added in v1.10.0 (function)

partitionMap

<RL, RR, A>(
  fa: Record<string, A>,
  f: (a: A) => Either<RL, RR>
): Separated<Record<string, RL>, Record<string, RR>>

Added in v1.10.0 (function)

partitionMapWithIndex

partitionMapWithIndex<RL, RR, A>(
  fa: Record<string, A>,
  f: (key: string, a: A) => Either<RL, RR>
): Separated<Record<string, RL>, Record<string, RR>>

Added in v1.12.0 (function)

partitionWithIndex

partitionWithIndex<A>(
  fa: Record<string, A>,
  p: (key: string, a: A) => boolean
): Separated<Record<string, A>, Record<string, A>>

Added in v1.12.0 (function)

pop

<A>(k: string, d: Record<string, A>): Option<[A, Record<string, A>]>

Added in v1.10.0 (function)

Delete a key and value from a map, returning the value as well as the subsequent map

reduce

<A, B>(fa: Record<string, A>, b: B, f: (b: B, a: A) => B): B

Added in v1.10.0 (function)

reduceWithKey

reduceWithKey<A, B>(fa: Record<string, A>, b: B, f: (k: string, b: B, a: A) => B): B

Added in v1.12.0 (function)

remove

remove<A>(k: string, d: Record<string, A>): Record<string, A>

Added in v1.10.0 (function)

Delete a key and value from a map

separate

<RL, RR>(
  fa: Record<string, Either<RL, RR>>
): Separated<Record<string, RL>, Record<string, RR>>

Added in v1.10.0 (function)

sequence

sequence<F>(F: Applicative<F>): <A>(ta: Record<string, HKT<F, A>>) => HKT<F, Record<string, A>>

Added in v1.10.0 (function)

singleton

<K extends string, A>(k: K, a: A): Record<K, A>

Added in v1.10.0 (function)

Create a dictionary with one key/value pair

size

<A>(d: Record<string, A>): number

Added in v1.10.0 (function)

Calculate the number of key/value pairs in a dictionary

toArray

toArray<A>(d: Record<string, A>): Array<[string, A]>

Added in v1.10.0 (function)

toUnfoldable

<F>(unfoldable: Unfoldable<F>) => <A>(d: Record<string, A>): HKT<F, [string, A]>

Added in v1.10.0 (function)

Unfolds a dictionary into a list of key/value pairs

traverse

traverse<F>(
  F: Applicative<F>
): <A, B>(ta: Record<string, A>, f: (a: A) => HKT<F, B>) => HKT<F, Record<string, B>>

Added in v1.10.0 (function)

traverseWithKey

traverseWithKey<F>(
  F: Applicative<F>
): <A, B>(ta: Record<string, A>, f: (k: string, a: A) => HKT<F, B>) => HKT<F, Record<string, B>>

Added in v1.10.0 (function)

wilt

wilt<F>(
  F: Applicative<F>
): (<RL, RR, A>(
  wa: Record<string, A>,
  f: (a: A) => HKT<F, Either<RL, RR>>
) => HKT<F, Separated<Record<string, RL>, Record<string, RR>>>)

Added in v1.10.0 (function)

wither

wither<F>(
  F: Applicative<F>
): (<A, B>(wa: Record<string, A>, f: (a: A) => HKT<F, Option<B>>) => HKT<F, Record<string, B>>)

Added in v1.10.0 (function)