effect-io-ai

Package: @effect/typeclass
Module: Semigroup

Semigroup.struct

This function creates and returns a new Semigroup for a struct of values based on the given Semigroups for each property in the struct. The returned Semigroup combines two structs of the same type by applying the corresponding Semigroup passed as arguments to each property in the struct.

It is useful when you need to combine two structs of the same type and you have a specific way of combining each property of the struct.

Signature

declare const struct: <R extends { readonly [x: string]: Semigroup<any>; }>(fields: R) => Semigroup<{ readonly [K in keyof R]: [R[K]] extends [Semigroup<infer A>] ? A : never; }>

Source

Since v0.24.0