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::explicit::*,
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 arrow;
27pub mod bifoldable;
28pub mod bifunctor;
29pub mod bitraversable;
30pub mod category;
31pub mod clone_fn;
32pub mod commutative_ring;
33pub mod comonad;
34pub mod compactable;
35pub mod contravariant;
36pub mod deferrable;
37pub mod division_ring;
38pub mod euclidean_ring;
39pub mod extend;
40pub mod extract;
41pub mod field;
42pub mod filterable;
43pub mod filterable_with_index;
44pub mod foldable;
45pub mod foldable_with_index;
46pub mod functor;
47pub mod functor_with_index;
48pub mod heyting_algebra;
49pub mod lazy_config;
50pub mod lift;
51pub mod monad;
52pub mod monad_plus;
53pub mod monad_rec;
54pub mod monoid;
55pub mod natural_transformation;
56pub mod optics;
57pub mod par_compactable;
58pub mod par_filterable;
59pub mod par_filterable_with_index;
60pub mod par_foldable;
61pub mod par_foldable_with_index;
62pub mod par_functor;
63pub mod par_functor_with_index;
64pub mod par_ref_filterable;
65pub mod par_ref_filterable_with_index;
66pub mod par_ref_foldable;
67pub mod par_ref_foldable_with_index;
68pub mod par_ref_functor;
69pub mod par_ref_functor_with_index;
70pub mod pipe;
71pub mod plus;
72pub mod pointed;
73pub mod pointer;
74pub mod profunctor;
75pub mod ref_alt;
76pub mod ref_applicative;
77pub mod ref_apply_first;
78pub mod ref_apply_second;
79pub mod ref_bifoldable;
80pub mod ref_bifunctor;
81pub mod ref_bitraversable;
82pub mod ref_compactable;
83pub mod ref_counted_pointer;
84pub mod ref_filterable;
85pub mod ref_filterable_with_index;
86pub mod ref_foldable;
87pub mod ref_foldable_with_index;
88pub mod ref_functor;
89pub mod ref_functor_with_index;
90pub mod ref_lift;
91pub mod ref_monad;
92pub mod ref_pointed;
93pub mod ref_semiapplicative;
94pub mod ref_semimonad;
95pub mod ref_traversable;
96pub mod ref_traversable_with_index;
97pub mod ref_witherable;
98pub mod ring;
99pub mod semiapplicative;
100pub mod semigroup;
101pub mod semigroupoid;
102pub mod semimonad;
103pub mod semiring;
104pub mod send_clone_fn;
105pub mod send_deferrable;
106pub mod send_ref_applicative;
107pub mod send_ref_apply_first;
108pub mod send_ref_apply_second;
109pub mod send_ref_counted_pointer;
110pub mod send_ref_foldable;
111pub mod send_ref_foldable_with_index;
112pub mod send_ref_functor;
113pub mod send_ref_functor_with_index;
114pub mod send_ref_lift;
115pub mod send_ref_monad;
116pub mod send_ref_pointed;
117pub mod send_ref_semiapplicative;
118pub mod send_ref_semimonad;
119pub mod send_unsized_coercible;
120pub mod traversable;
121pub mod traversable_with_index;
122pub mod unsized_coercible;
123pub mod with_index;
124pub mod witherable;
125
126// Automatically re-export all traits defined in submodules.
127fp_macros::generate_trait_re_exports!("src/classes", {});