Help us shape the future of Go! Take the 2026 Go Developer Survey

testing

package
v2.10.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertComposition deprecated

func AssertComposition[HKTA, HKTB, HKTC, A, B, C any](
	t *testing.T,

	eq E.Eq[HKTC],

	fab func(HKTA, func(A) B) HKTB,
	fac func(HKTA, func(A) C) HKTC,
	fbc func(HKTB, func(B) C) HKTC,
	ab func(A) B,
	bc func(B) C,
) func(fa HKTA) bool

Functor composition law

F.map(fa, a => bc(ab(a))) <-> F.map(F.map(fa, ab), bc)

Deprecated: use FunctorAssertComposition instead

func AssertIdentity deprecated

func AssertIdentity[HKTA, A any](t *testing.T, eq E.Eq[HKTA], fmap func(HKTA, func(A) A) HKTA) func(fa HKTA) bool

Functor identity law

F.map(fa, a => a) <-> fa

Deprecated: use FunctorAssertIdentity

func AssertLaws deprecated

func AssertLaws[HKTA, HKTB, HKTC, A, B, C any](t *testing.T,
	eqa E.Eq[HKTA],
	eqc E.Eq[HKTC],

	faa func(HKTA, func(A) A) HKTA,
	fab func(HKTA, func(A) B) HKTB,
	fac func(HKTA, func(A) C) HKTC,
	fbc func(HKTB, func(B) C) HKTC,

	ab func(A) B,
	bc func(B) C,
) func(fa HKTA) bool

AssertLaws asserts the functor laws `identity` and `composition`

Deprecated: use FunctorAssertLaws instead

func FunctorAssertComposition

func FunctorAssertComposition[HKTA, HKTB, HKTC, A, B, C any](
	t *testing.T,

	eq E.Eq[HKTC],

	fab functor.Functor[A, B, HKTA, HKTB],
	fac functor.Functor[A, C, HKTA, HKTC],
	fbc functor.Functor[B, C, HKTB, HKTC],

	ab func(A) B,
	bc func(B) C,
) func(fa HKTA) bool

Functor composition law

F.map(fa, a => bc(ab(a))) <-> F.map(F.map(fa, ab), bc)

func FunctorAssertIdentity

func FunctorAssertIdentity[HKTA, A any](
	t *testing.T,
	eq E.Eq[HKTA],

	fca functor.Functor[A, A, HKTA, HKTA],
) func(fa HKTA) bool

Functor identity law

F.map(fa, a => a) <-> fa

func FunctorAssertLaws

func FunctorAssertLaws[HKTA, HKTB, HKTC, A, B, C any](t *testing.T,
	eqa E.Eq[HKTA],
	eqc E.Eq[HKTC],

	faa functor.Functor[A, A, HKTA, HKTA],
	fab functor.Functor[A, B, HKTA, HKTB],
	fac functor.Functor[A, C, HKTA, HKTC],
	fbc functor.Functor[B, C, HKTB, HKTC],

	ab func(A) B,
	bc func(B) C,
) func(fa HKTA) bool

FunctorAssertLaws asserts the functor laws `identity` and `composition`

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL