Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace arbitrary

Index

Interfaces Model

Type aliases Model

Type aliases Other

Variables Model

Variables Typeclasses

Functions Apply

Functions Chain

Functions Combinators

Functions Constructors

Functions Destructors

Functions Functor

Functions Other

Functions Pointed

Functions Primitives

Model Type aliases

URI: typeof arbitrary.URI

Other Type aliases

StringParams: Partial<Record<"from" | "to", string>>

Model Variables

URI: "Arbitrary" = "Arbitrary"

Typeclasses Variables

Applicative: Applicative1<arbitrary.URI> = ...
Apply: Apply1<arbitrary.URI> = ...
Chain: Chain1<arbitrary.URI> = ...
Functor: Functor1<arbitrary.URI> = ...
Pointed: Pointed1<arbitrary.URI> = ...

Apply Functions

Chain Functions

Combinators Functions

  • summary

    Generates an array with a random size, then each has the random contents.

    Type parameters

    • A

    Parameters

    Returns Arbitrary<ReadonlyArray<A>>

  • Arbitrary cannot have a Compactable typeclass instance, as the state needs to be supplied and called before being able to seperate the output conditionally.

    Type parameters

    • A

    • B

    Parameters

    • refinement: Refinement<A, B>

    Returns (fa: Arbitrary<A>) => Arbitrary<B>

      • Arbitrary cannot have a Compactable typeclass instance, as the state needs to be supplied and called before being able to seperate the output conditionally.

        category

        Combinators

        Parameters

        Returns Arbitrary<B>

  • Type parameters

    • A

    Parameters

    • predicate: Predicate<A>

    Returns (fa: Arbitrary<A>) => Arbitrary<A>

  • Allows use of an arbitrary that is used after the current arbitrary is defined. Useful for recursive patterns.

    example

    const y = AR.lazy(() => x) const x = AR.of(constVoid()) // now y can use x without it being unreachable code

    Type parameters

    • A

    Parameters

    Returns Arbitrary<A>

  • summary

    Removes the Readonly type constraint from the value within an Arbitrary instance.

    Type parameters

    • A

    Parameters

    Returns Arbitrary<A>

  • Allow generating arbitraries of T or null.

    Type parameters

    • T

    Parameters

    Returns Arbitrary<null | T>

  • Adds the Readonly type constraint from the value within an Arbitrary instance.

    Type parameters

    • A

    Parameters

    Returns Arbitrary<Readonly<A>>

  • struct<R>(struct: EnforceNonEmptyRecord<{ readonly [ P in string | number | symbol]: Arbitrary<R[P]> }>): Arbitrary<{}>
  • Type parameters

    • R: Record<string, unknown>

    Parameters

    • struct: EnforceNonEmptyRecord<{ readonly [ P in string | number | symbol]: Arbitrary<R[P]> }>

    Returns Arbitrary<{}>

  • tuple<R>(...arbitraries: R): Arbitrary<[...{ [ K in string | number | symbol]: [R[K]] extends [Arbitrary<A>] ? A : never }[]]>
  • Type parameters

    Parameters

    • Rest ...arbitraries: R

    Returns Arbitrary<[...{ [ K in string | number | symbol]: [R[K]] extends [Arbitrary<A>] ? A : never }[]]>

  • union<T>(...arbitraries: { readonly [ P in string | number | symbol]: Arbitrary<T[P]> }): Arbitrary<T[number]>
  • Type parameters

    • T: readonly [unknown, unknown, T]

    Parameters

    • Rest ...arbitraries: { readonly [ P in string | number | symbol]: Arbitrary<T[P]> }

    Returns Arbitrary<T[number]>

  • Generates an array with a fixed size, then each has the random contents.

    Parameters

    • size: number

    Returns <A>(fa: Arbitrary<A>) => Arbitrary<readonly A[]>

Constructors Functions

  • summary

    Lift a generator into the Arbitrary typeclass.

    Type parameters

    • A

    Parameters

    Returns Arbitrary<A>

  • int(...a: [{ max?: number; min?: number }?]): Gen<Rose<number>>
  • Parameters

    • Rest ...a: [{ max?: number; min?: number }?]

    Returns Gen<Rose<number>>

Destructors Functions

  • Type parameters

    • A

    Parameters

    Returns Gen<A>

Functor Functions

Other Functions

  • character(options?: Partial<Record<"from" | "to", string>>): Arbitrary<string>
  • Parameters

    • Optional options: Partial<Record<"from" | "to", string>>

    Returns Arbitrary<string>

  • fromGenK<T, A>(gen_: (...args: T) => Gen<A>): (...args: T) => Arbitrary<A>
  • Type parameters

    • T: readonly unknown[]

    • A

    Parameters

    • gen_: (...args: T) => Gen<A>
        • (...args: T): Gen<A>
        • Parameters

          • Rest ...args: T

          Returns Gen<A>

    Returns (...args: T) => Arbitrary<A>

  • fromShrink<A>(f: Shrink<A>): (a: A) => Rose<A>
  • Type parameters

    • A

    Parameters

    Returns (a: A) => Rose<A>

      • (a: A): Rose<A>
      • Parameters

        • a: A

        Returns Rose<A>

  • Type parameters

    • A

    Parameters

    Returns Arbitrary<A>

  • string(options?: Partial<Record<"from" | "to", string>>): Arbitrary<string>
  • Parameters

    • Optional options: Partial<Record<"from" | "to", string>>

    Returns Arbitrary<string>

  • stringNonempty(options?: Partial<Record<"from" | "to", string>>): Arbitrary<string>
  • Parameters

    • Optional options: Partial<Record<"from" | "to", string>>

    Returns Arbitrary<string>

Pointed Functions

  • Type parameters

    • A

    Parameters

    • a: A

    Returns Arbitrary<A>

Primitives Functions

  • Parameters

    Returns [Rose<boolean>, GenState]

Generated using TypeDoc