Skip to main content

fp_library/
classes.rs

1//! Defines traits for common algebraic structures and functional abstractions,
2//! such as [`Functor`], [`Applicative`] and [`Monad`].
3//!
4//! Traits representing higher-kinded types (e.g., `Functor`) are implemented by
5//! [`Brand` types][crate::brands] to simulate higher-kinded polymorphism, as Rust does not
6//! natively support it.
7//!
8//! ### Examples
9//!
10//! ```
11//! use fp_library::{
12//! 	brands::*,
13//! 	functions::*,
14//! };
15//!
16//! let x = Some(5);
17//! let y = map::<OptionBrand, _, _>(|i| i * 2, x);
18//! assert_eq!(y, Some(10));
19//! ```
20
21pub mod applicative;
22pub mod apply_first;
23pub mod apply_second;
24pub mod bifoldable;
25pub mod bifunctor;
26pub mod bitraversable;
27pub mod category;
28pub mod cloneable_fn;
29pub mod compactable;
30pub mod contravariant;
31pub mod deferrable;
32pub mod evaluable;
33pub mod filterable;
34pub mod foldable;
35pub mod foldable_with_index;
36pub mod function;
37pub mod functor;
38pub mod functor_with_index;
39pub mod lift;
40pub mod monad;
41pub mod monad_rec;
42pub mod monoid;
43pub mod optics;
44pub mod par_foldable;
45pub mod pointed;
46pub mod pointer;
47pub mod profunctor;
48pub mod ref_counted_pointer;
49pub mod ref_functor;
50pub mod semiapplicative;
51pub mod semigroup;
52pub mod semigroupoid;
53pub mod semimonad;
54pub mod send_cloneable_fn;
55pub mod send_deferrable;
56pub mod send_ref_counted_pointer;
57pub mod send_unsized_coercible;
58pub mod traversable;
59pub mod traversable_with_index;
60pub mod unsized_coercible;
61pub mod witherable;
62
63// Automatically re-export all traits defined in submodules.
64fp_macros::generate_trait_re_exports!("src/classes", {});