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 comonad;
33pub mod compactable;
34pub mod contravariant;
35pub mod deferrable;
36pub mod division_ring;
37pub mod euclidean_ring;
38pub mod extend;
39pub mod extract;
40pub mod field;
41pub mod filterable;
42pub mod foldable;
43pub mod foldable_with_index;
44pub mod function;
45pub mod functor;
46pub mod functor_with_index;
47pub mod heyting_algebra;
48pub mod lazy_config;
49pub mod lift;
50pub mod monad;
51pub mod monad_plus;
52pub mod monad_rec;
53pub mod monoid;
54pub mod natural_transformation;
55pub mod optics;
56pub mod par_compactable;
57pub mod par_filterable;
58pub mod par_foldable;
59pub mod par_foldable_with_index;
60pub mod par_functor;
61pub mod par_functor_with_index;
62pub mod pipe;
63pub mod plus;
64pub mod pointed;
65pub mod pointer;
66pub mod profunctor;
67pub mod ref_counted_pointer;
68pub mod ref_functor;
69pub mod ring;
70pub mod semiapplicative;
71pub mod semigroup;
72pub mod semigroupoid;
73pub mod semimonad;
74pub mod semiring;
75pub mod send_cloneable_fn;
76pub mod send_deferrable;
77pub mod send_ref_counted_pointer;
78pub mod send_ref_functor;
79pub mod send_unsized_coercible;
80pub mod traversable;
81pub mod traversable_with_index;
82pub mod try_lazy_config;
83pub mod unsized_coercible;
84pub mod with_index;
85pub mod witherable;
86
87// Automatically re-export all traits defined in submodules.
88fp_macros::generate_trait_re_exports!("src/classes", {});