1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//! Prelude: Trait Extensions
//!
//! This module re-exports extension traits for Rustica's core functional abstractions.
//! These extension traits provide ergonomic methods and utility functions for working
//! with functors, monoids, foldables, and more.
//!
//! # Example Usage
//!
//! ```rust
//! use rustica::prelude::traits_ext::*;
//! use rustica::prelude::wrapper::*;
//! use rustica::datatypes::maybe::Maybe;
//! use rustica::traits::functor::Functor;
//!
//! let x = Maybe::Just(10);
//! let y = x.fmap(|n| n + 1);
//! assert_eq!(y, Maybe::Just(11));
//!
//! use rustica::traits::foldable::{Foldable, FoldableExt};
//! let xs = vec![Maybe::Just(1), Maybe::Just(2), Maybe::Nothing];
//! let sum = xs.fold_map(|m| Sum(m.unwrap_or(0)));
//! assert_eq!(sum.0, 3);
//!
//! use rustica::traits::monoid::MonoidExt;
//! use rustica::traits::semigroup::Semigroup;
//! let vals = vec![1, 2, 3];
//! let total = vals.iter().cloned().map(Sum).fold(Sum(0), |a, b| a.combine_owned(b));
//! assert_eq!(total.0, 6);
//! ```
pub use crateEvaluateExt;
pub use crateFoldableExt;
pub use crateFunctorExt;
pub use crateIsoExt;
pub use crateMonoidExt;
pub use cratePureExt;
pub use crateSemigroupExt;