Skip to content

v0.1.0

Choose a tag to compare

@justinelliottcobb justinelliottcobb released this 06 Mar 21:41
· 80 commits to main since this release
5499209

Karpal v0.1.0

First public release of the Karpal HKT library for Rust — a GAT-based higher-kinded type system for the Industrial Algebra ecosystem.

Crates

Crate Description
karpal-core HKT encoding, full functor hierarchy, algebraic structures, comonads, macros (no_std)
karpal-profunctor Profunctor, Strong, Choice with FnP (no_std)
karpal-optics Profunctor optics: Lens, ComposedLens, Prism
karpal-arrow Category/Arrow hierarchy: 8 traits + FnA, KleisliF, CokleisliF (no_std)
karpal-std Prelude re-exports for all crates

Highlights

  • GAT-based HKT encodingtrait HKT { type Of<T>; } / trait HKT2 { type P<A, B>; }, zero dependencies, stable since Rust 1.65
  • Full functor hierarchy — Functor, Apply, Applicative, Chain, Monad, Alt, Plus, Alternative, Bifunctor, Contravariant, Foldable, Traversable, FunctorFilter, Selective, NaturalTransformation
  • Comonad family — Comonad, Extend, ComonadEnv, ComonadStore, ComonadTraced, Invariant
  • Profunctor optics — Lens and Prism via profunctor encoding with composition support
  • Arrow hierarchy — Semigroupoid, Category, Arrow, ArrowChoice, ArrowApply, ArrowLoop, ArrowZero, ArrowPlus
  • do_! / ado_! macros — monadic and applicative do-notation
  • 287 tests including property-based law verification via proptest
  • no_std compatible core crates (karpal-core, karpal-profunctor, karpal-arrow)

Documentation

📖 karpal.industrialalgebra.com

Getting Started

[dependencies]
karpal-std = "0.1.0"
use karpal_std::prelude::*;

let doubled = OptionF::fmap(Some(21), |x| x * 2);
assert_eq!(doubled, Some(42));