Function defineConcreteLaws

Define a set of laws for some typeclass on a concrete type.

  • Type Parameters

    Parameters

    • typeclassName: string

      Used as label for test description() block.

    • Rest...laws: {
          [K in string | number | symbol]: Law<Ts[K<K>]>
      }

      list of Law to test.

    Returns ((suffix?: string, ...sets: LawSet[]) => LawSet)

    A set of laws ready to be tested.

      • (suffix?, ...sets): LawSet
      • Parameters

        • suffix: string = ''

          Optional suffix to attach to LawTest label. Used, for example, to differentiate between the different Monoid instances of Boolean.

        • Rest...sets: LawSet[]

          Optional list of LawSets that are required for the typeclass under test. For example, the Monoid laws require the instance under test pass the Semigroup laws besides the Monoid laws themselves. They do this by adding the Semigroup laws in this field.

        Returns LawSet