MCPcopy Index your code
hub / github.com/Effect-TS/effect / struct

Function struct

packages/typeclass/src/Monoid.ts:101–111  ·  view source on GitHub ↗
(
  fields: R
)

Source from the content-addressed store, hash-verified

99 * @since 0.24.0
100 */
101export const struct = <R extends { readonly [x: string]: Monoid<any> }>(
102 fields: R
103): Monoid<{ readonly [K in keyof R]: [R[K]] extends [Monoid<infer A>] ? A : never }> => {
104 const empty = {} as any
105 for (const k in fields) {
106 if (Object.prototype.hasOwnProperty.call(fields, k)) {
107 empty[k] = fields[k].empty
108 }
109 }
110 return fromSemigroup(semigroup.struct(fields), empty)
111}

Callers 1

Product.test.tsFile · 0.50

Calls 1

fromSemigroupFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…