Expand description
Functional programming type classes.
This module defines traits for common algebraic structures and functional abstractions,
such as Functor, Applicative and Monad.
Traits representing higher-kinded types (e.g., Functor) are implemented by
Brand types to simulate higher-kinded polymorphism, as Rust does not
natively support it.
§Examples
use fp_library::{brands::*, functions::*};
let x = Some(5);
let y = map::<OptionBrand, _, _, _>(|i| i * 2, x);
assert_eq!(y, Some(10));Modules§
- applicative
- Applicative functors.
- apply_
first - ApplyFirst type class.
- apply_
second - ApplySecond type class.
- category
- Category theory abstractions.
- clonable_
fn - Clonable function wrappers.
- compactable
- Compactable type class.
- defer
- Defer type class.
- filterable
- Filterable type class.
- foldable
- Foldable type class.
- function
- Function wrappers.
- functor
- Functor type class.
- lift
- Lift type class.
- monad
- Monad type class.
- monoid
- Monoid type class.
- once
- Once type class.
- par_
foldable - Parallel folding operations.
- pointed
- Pointed type class.
- semiapplicative
- Semiapplicative type class.
- semigroup
- Semigroup type class.
- semigroupoid
- Semigroupoid type class.
- semimonad
- Semimonad type class.
- send_
clonable_ fn - Thread-safe clonable function wrappers.
- traversable
- Traversable type class.
- witherable
- Witherable type class.