ordofp_laws 0.1.0

Property-based laws testing for OrdoFP type classes including Functor, Monad, and algebraic structures.
Documentation
  • Coverage
  • 100%
    143 out of 143 items documented9 out of 133 items with examples
  • Size
  • Source code size: 150.65 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.81 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 6s Average build duration of successful builds.
  • all releases: 6s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • ordokr/ordofp
    9 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ordokr

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 for FunctorAsync
  • [async_monad_laws] - Left/right identity and associativity for MonadAsync

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 relating Fix, cata, and ana

Usage with QuickCheck

use ordofp_laws::functor_laws;
use quickcheck::quickcheck;

quickcheck(functor_laws::identity::<Option<i32>> as fn(Option<i32>) -> bool);