Record
Instances
Signature
declare const Covariant: Covariant<ReadonlyRecordTypeLambda<string>>Signature
declare const Filterable: Filterable<ReadonlyRecordTypeLambda<string>>Signature
declare function getCovariant<K extends string>(): Covariant<ReadonlyRecordTypeLambda<K>>Signature
declare function getFilterable<K extends string>(): Filterable<ReadonlyRecordTypeLambda<K>>Signature
declare function getInvariant<K extends string>(): Invariant<ReadonlyRecordTypeLambda<K>>A Monoid that creates a union of two records.
It allows combining two records where values for matching keys are combined using the provided Monoid instance.
If a key exists in only one of the records, that key-value pair is included as is in the resulting record.
The empty value for this Monoid is an empty record {}.
Signature
declare const getMonoidUnion: <A>(value: monoid.Monoid<A>) => monoid.Monoid<Record.ReadonlyRecord<string, A>>Example
import * as NumberInstances from "@effect/typeclass/data/Number"import { getMonoidUnion } from "@effect/typeclass/data/Record"
const monoid = getMonoidUnion(NumberInstances.MonoidSum)
console.log(monoid.combine({ a: 1 }, { a: 1, b: 3 }))// { a: 2, b: 3 }
console.log(monoid.combine({ a: 1 }, monoid.empty))// { a: 1 }A Semigroup that creates an intersection of two records.
This Semigroup takes two records and combines them into a new record containing only the keys that are present in both records.
The values for matching keys are combined using the provided Semigroup instance.
Signature
declare const getSemigroupIntersection: <A>(value: semigroup.Semigroup<A>) => semigroup.Semigroup<Record.ReadonlyRecord<string, A>>Example
import * as NumberInstances from "@effect/typeclass/data/Number"import { getSemigroupIntersection } from "@effect/typeclass/data/Record"
console.log(getSemigroupIntersection(NumberInstances.MonoidSum).combine({ a: 1 }, { a: 1, b: 3 }))// { a: 2 }A Semigroup that creates a union of two records.
This Semigroup takes two records and combines them into a single record.
If a key exists in both records, the provided Semigroup instance is used to combine the values for that key.
If a key exists in only one of the records, that key-value pair is included as is in the resulting record.
For example, when using the MonoidSum, values for matching keys will be summed.
Signature
declare const getSemigroupUnion: <A>(value: semigroup.Semigroup<A>) => semigroup.Semigroup<Record.ReadonlyRecord<string, A>>Example
import * as NumberInstances from "@effect/typeclass/data/Number"import { getSemigroupUnion } from "@effect/typeclass/data/Record"
console.log(getSemigroupUnion(NumberInstances.MonoidSum).combine({ a: 1 }, { a: 1, b: 3 }))// { a: 2, b: 3 }Signature
declare function getTraversable<K extends string>(): Traversable<ReadonlyRecordTypeLambda<K>>Signature
declare function getTraversableFilterable<K extends string>(): TraversableFilterable<ReadonlyRecordTypeLambda<K>>Signature
declare const Invariant: Invariant<ReadonlyRecordTypeLambda<string>>Signature
declare const Traversable: Traversable<ReadonlyRecordTypeLambda<string>>Signature
declare const TraversableFilterable: TraversableFilterable<ReadonlyRecordTypeLambda<string>>