OrdoFP Laws
This library contains property-based laws for testing implementations of
type classes declared in OrdoFP. Laws help ensure that your implementations
are mathematically correct and composable.
Available Law Modules
Core Algebraic Laws
- [
semigroup_laws] - Associativity law for Semigroup - [
monoid_laws] - Identity laws for Monoid - [
optics_laws] - Lens (GetPut/PutGet/PutPut) and prism laws
Functor Hierarchy Laws
- [
functor_laws] - Identity and composition laws for GAT Functor - [
applicative_laws] - Laws for Applicative functors - [
monad_laws] - Left/right identity and associativity for Monad - [
alternative_laws] - Choice/failure laws for Alternative
Async Type Class Laws (requires async feature)
- [
async_functor_laws] - Identity and composition laws forFunctorAsync - [
async_monad_laws] - Left/right identity and associativity forMonadAsync
Other Type Class Laws
- [
foldable_laws] - Consistency laws for Foldable - [
traversable_laws] - Identity, naturality laws for Traversable - [
comonad_laws] - Extract/extend laws for Comonad - [
bifunctor_laws] - Identity and composition for Bifunctor - [
category_laws] - Identity and associativity laws for Category - [
fixpoint_laws] - Laws relatingFix,cata, andana
Usage with QuickCheck
use ordofp_laws::functor_laws;
use quickcheck::quickcheck;
quickcheck(functor_laws::identity::<Option<i32>> as fn(Option<i32>) -> bool);