MCPcopy Create free account
hub / github.com/Effect-TS/effect / causeReasonToArbitrary

Function causeReasonToArbitrary

packages/effect/src/Schema.ts:10393–10407  ·  view source on GitHub ↗
(
  error: Annotations.ToArbitrary.TypeParameter<E>,
  defect: Annotations.ToArbitrary.TypeParameter<D>
)

Source from the content-addressed store, hash-verified

10391)
10392
10393function causeReasonToArbitrary<E, D>(
10394 error: Annotations.ToArbitrary.TypeParameter<E>,
10395 defect: Annotations.ToArbitrary.TypeParameter<D>
10396) {
10397 return (fc: typeof FastCheck, ctx: Annotations.ToArbitrary.Context) => {
10398 const terminal = fc.constant(Cause_.makeInterruptReason())
10399 const arbitrary = fc.oneof(
10400 terminal,
10401 fc.integer({ min: 1 }).map(Cause_.makeInterruptReason),
10402 error.arbitrary.map((e) => Cause_.makeFailReason(e)),
10403 defect.arbitrary.map((d) => Cause_.makeDieReason(d))
10404 )
10405 return withRecursion(fc, ctx, terminal, arbitrary)
10406 }
10407}
10408
10409function causeReasonToEquivalence<E>(error: Equivalence.Equivalence<E>, defect: Equivalence.Equivalence<unknown>) {
10410 return (a: Cause_.Reason<E>, b: Cause_.Reason<E>) => {

Callers 2

CauseReasonFunction · 0.85
causeToArbitraryFunction · 0.85

Calls 2

withRecursionFunction · 0.85
mapMethod · 0.45

Tested by

no test coverage detected