testing

package
v1.0.151 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertAssociativity deprecated

func AssertAssociativity[HKTA, HKTB, HKTC, A, B, C any](t *testing.T,
	eq E.Eq[HKTC],

	fofb func(B) HKTB,
	fofc func(C) HKTC,

	chainab func(HKTA, func(A) HKTB) HKTB,
	chainac func(HKTA, func(A) HKTC) HKTC,
	chainbc func(HKTB, func(B) HKTC) HKTC,

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

Chain associativity law

F.chain(F.chain(fa, afb), bfc) <-> F.chain(fa, a => F.chain(afb(a), bfc))

Deprecated: use ChainAssertAssociativity instead

func AssertLaws deprecated

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

	fofb func(B) HKTB,
	fofc func(C) HKTC,

	fofab func(func(A) B) HKTAB,
	fofbc func(func(B) C) HKTBC,

	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,

	fmap func(HKTBC, func(func(B) C) func(func(A) B) func(A) C) HKTABAC,

	chainab func(HKTA, func(A) HKTB) HKTB,
	chainac func(HKTA, func(A) HKTC) HKTC,
	chainbc func(HKTB, func(B) HKTC) HKTC,

	fapab func(HKTAB, HKTA) HKTB,
	fapbc func(HKTBC, HKTB) HKTC,
	fapac func(HKTAC, HKTA) HKTC,

	fapabac func(HKTABAC, HKTAB) HKTAC,

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

AssertLaws asserts the apply laws `identity`, `composition`, `associative composition` and `associativity`

Deprecated: use ChainAssertLaws instead

func ChainAssertAssociativity added in v1.0.127

func ChainAssertAssociativity[HKTA, HKTB, HKTC, HKTAB, HKTAC, HKTBC, A, B, C any](t *testing.T,
	eq E.Eq[HKTC],

	fofb pointed.Pointed[B, HKTB],
	fofc pointed.Pointed[C, HKTC],

	chainab chain.Chainable[A, B, HKTA, HKTB, HKTAB],
	chainac chain.Chainable[A, C, HKTA, HKTC, HKTAC],
	chainbc chain.Chainable[B, C, HKTB, HKTC, HKTBC],

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

Chain associativity law

F.chain(F.chain(fa, afb), bfc) <-> F.chain(fa, a => F.chain(afb(a), bfc))

func ChainAssertLaws added in v1.0.127

func ChainAssertLaws[HKTA, HKTB, HKTC, HKTAB, HKTBC, HKTAC, HKTABAC, A, B, C any](t *testing.T,
	eqa E.Eq[HKTA],
	eqc E.Eq[HKTC],

	fofb pointed.Pointed[B, HKTB],
	fofc pointed.Pointed[C, HKTC],

	fofab pointed.Pointed[func(A) B, HKTAB],
	fofbc pointed.Pointed[func(B) C, HKTBC],

	faa functor.Functor[A, A, HKTA, HKTA],

	fmap functor.Functor[func(B) C, func(func(A) B) func(A) C, HKTBC, HKTABAC],

	chainab chain.Chainable[A, B, HKTA, HKTB, HKTAB],
	chainac chain.Chainable[A, C, HKTA, HKTC, HKTAC],
	chainbc chain.Chainable[B, C, HKTB, HKTC, HKTBC],

	fapabac apply.Apply[func(A) B, func(A) C, HKTAB, HKTAC, HKTABAC],

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

ChainAssertLaws asserts the apply laws `identity`, `composition`, `associative composition` and `associativity`

Types

This section is empty.

Jump to

Keyboard shortcuts

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