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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//! # Utility Functions and Helpers
//!
//! This module provides a collection of utility functions and types that support
//! functional programming patterns in Rust. These utilities enhance the core traits
//! and datatypes with practical tools for common operations.
//!
//! ## Module Structure
//!
//! The utilities are organized into four main categories:
//!
//! ### Categorical Utilities (`categorical_utils`)
//!
//! Category theory-inspired utilities designed for Rust's type system:
//!
//! - Functor-inspired mapping helpers (`map_option`, `map_result`, `bimap_result`)
//! - Monad-inspired chaining helpers (`flat_map_option`, `flat_map_result`)
//! - Function composition utilities (`compose`, `pipe`)
//! - Collection sequencing operations (`sequence_options`, `sequence_results`)
//! - Following categorical laws
//!
//! ### Error Handling Utilities (`crate::error`)
//!
//! Error handling utilities have been consolidated under the top-level `crate::error` module.
//! Prefer importing from `rustica::error` or `rustica::prelude::error`.
//!
//! ### Higher-Kinded Type Utilities (`hkt_utils`)
//!
//! Generic functions and transformations for working with higher-kinded types:
//!
//! - Composition utilities for functions and transformations
//! - Pipeline operations for chaining computations
//! - Collection utilities like `filter_map`, `fan_out`, and `zip_with`
//!
//! ### Transformation Utilities (`transform_utils`)
//!
//! Tools for data transformation and operation chaining:
//!
//! - `transform_all` for applying transformations to collections
//! - `transform_chain` for optional transformations
//! - `Pipeline` type for fluent transformation chaining
/// Higher-kinded type utilities for generic programming.
///
/// This module provides functions and utilities for working with higher-kinded
/// types and generic operations, including:
///
/// - Pipeline operations for chaining computations
/// - Lifting and mapping functions for different contexts
/// - Collection operations that preserve context
/// - Function composition utilities
/// Data transformation utilities for functional operations.
///
/// This module provides utilities for transforming data in a functional style,
/// including:
///
/// - Transformation operations for functorial types
/// - Pipeline abstractions for chaining operations
/// - Transformation utilities for collections
/// Category theory-inspired utilities for functional programming.
///
/// This module provides utility functions based on category theory concepts,
/// specifically designed for Rust's type system and ownership model. These
/// utilities extend common operations on `Option`, `Result`, and other types
/// while maintaining categorical correctness and type safety.
///
/// Key features include:
///
/// - Functor-inspired mapping helpers for structure-preserving transformations
/// - Monad-inspired chaining helpers for sequencing computations with context
/// - Function composition utilities for building complex operations
/// - Collection utilities for working with sequences of optional/failable values
/// Basic function combinators and utilities.
///
/// This module provides fundamental functional programming utilities including:
///
/// - `id`: The identity function (identity morphism)
/// - `const_fn`: Create constant functions
///
/// These are the building blocks for functional composition and should be
/// available throughout the codebase.