effect-ts-laws
    Preparing search index...

    Function liftArbitraries

    • Given a LiftArbitrary function, and 1..n Arbitrarys for different types A₁, A₂, ...Aₙ, returns the given list except every arbitrary for type Aᵢ has been replaced by an arbitrary for type Kind<F, R, O, E, Aᵢ>. For example:

      Type Parameters

      • F extends TypeLambda
      • R = never
      • O = unknown
      • E = unknown

      Parameters

      Returns <const Arbs extends Arbitrary<unknown>[]>(
          ...arbs: Arbs,
      ) => {
          [K in string | number | symbol]: Arbitrary<
              Kind<F, R, O, E, Arbs[K<K>] extends Arbitrary<T> ? T : never>,
          >
      }

      import {option, liftArbitraries, tinyPositive, tinyIntegerArray} from 'effect-ts-laws'
      import {OptionTypeLambda} from 'effect/Option'
      import fc from 'fast-check'

      const [positive, integerArray] = liftArbitraries<OptionTypeLambda>(
      option,
      )(
      tinyPositive,
      tinyIntegerArray,
      )
      // typeof positive ≡ fc.Arbitrary<Option<number>>
      // typeof integerArray ≡ fc.Arbitrary<Option<readonly number[]>>

      console.log(fc.sample(positive, {numRuns: 1}))
      console.table(fc.sample(integerArray, {numRuns: 1}))