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 alt;
22pub mod alternative;
23pub mod applicative;
24pub mod apply_first;
25pub mod apply_second;
26pub mod bifoldable;
27pub mod bifunctor;
28pub mod bitraversable;
29pub mod category;
30pub mod cloneable_fn;
31pub mod commutative_ring;
32pub mod compactable;
33pub mod contravariant;
34pub mod deferrable;
35pub mod division_ring;
36pub mod euclidean_ring;
37pub mod evaluable;
38pub mod field;
39pub mod filterable;
40pub mod foldable;
41pub mod foldable_with_index;
42pub mod function;
43pub mod functor;
44pub mod functor_with_index;
45pub mod heyting_algebra;
46pub mod lift;
47pub mod monad;
48pub mod monad_rec;
49pub mod monoid;
50pub mod optics;
51pub mod par_foldable;
52pub mod pipe;
53pub mod plus;
54pub mod pointed;
55pub mod pointer;
56pub mod profunctor;
57pub mod ref_counted_pointer;
58pub mod ref_functor;
59pub mod ring;
60pub mod semiapplicative;
61pub mod semigroup;
62pub mod semigroupoid;
63pub mod semimonad;
64pub mod semiring;
65pub mod send_cloneable_fn;
66pub mod send_deferrable;
67pub mod send_ref_counted_pointer;
68pub mod send_unsized_coercible;
69pub mod traversable;
70pub mod traversable_with_index;
71pub mod unsized_coercible;
72pub mod witherable;
73
74// Automatically re-export all traits defined in submodules.
75fp_macros::generate_trait_re_exports!("src/classes", {});