Skip to main content

Crate ordofp_core

Crate ordofp_core 

Source
Expand description

OrdoFP Core

This library forms the core of OrdoFP. It should ideally be minimalistic, containing only the fundamental building blocks of Universalis programming.

§Examples


let h = hlist![1, false, 42f32];
let folded = h.foldr(hlist![|acc, i| i + acc,
    |acc, _| if acc > 42f32 { 9000 } else { 0 },
    |acc, f| f + acc],
    1f32);
assert_eq!(folded, 9001);

// Reverse
let h1 = hlist![true, "hi"];
assert_eq!(h1.into_reverse(), hlist!["hi", true]);

// foldr (foldl also available)
let h2 = hlist![1, false, 42f32];
let folded = h2.foldr(
            hlist![|acc, i| i + acc,
                   |acc, _| if acc > 42f32 { 9000 } else { 0 },
                   |acc, f| f + acc],
            1f32
    );
assert_eq!(folded, 9001);

// Mapping over an HList
let h3 = hlist![9000, "joe", 41f32];
let mapped = h3.to_ref().map(hlist![|&n| n + 1,
                              |&s| s,
                              |&f| f + 1f32]);
assert_eq!(mapped, hlist![9001, "joe", 42f32]);

// Plucking a value out by type
let h4 = hlist![1, "hello", true, 42f32];
let (t, remainder): (bool, _) = h4.pluck();
assert!(t);
assert_eq!(remainder, hlist![1, "hello", 42f32]);

// Resculpting an HList
let h5 = hlist![9000, "joe", 41f32, true];
let (reshaped, remainder2): (HList![f32, i32, &str], _) = h5.sculpt();
assert_eq!(reshaped, hlist![41f32, 9000, "joe"]);
assert_eq!(remainder2, hlist![true]);

Links:

  1. Source on Github
  2. Crates.io page

Modules§

alternative
Alternative type class for applicative functors with choice.
arena
Arena-Based Effect Handlers
async_core
Async Core Module - Asynchronous functional programming primitives.
bifunctor
Bifunctor type class for types with two type parameters.
category
Category Theory Foundations
comonad
Comonad type class - dual of Monad.
datatypes
Core Datatypes
dependent
Dependent Type Foundations - Typus Dependens
diagnostics
Diagnostics Module for OrdoFP
disiunctio
Module that holds Disiunctio (coproduct) data structures, traits, and implementations
distributed
Distributed Execution
easy
Easy API - Simplified Interface for OrdoFP
effects
Effect System Foundation - Lightweight algebraic effect infrastructure
ffi_bedrock
FFI Bedrock
fix
Fixed point of a functor.
foldable
Foldable type class for data structures that can be folded.
foldl
Composable Left Folds (Hadolint Pattern)
free
Free Monads and Tagless Final - DSL Interpreters
gat
GAT-based Type Classes for Higher Kinded Types simulation.
hints
Branch Prediction Hints
hlist
Module that holds HList data structures, implementations, and typeclasses.
indices
Types used for indexing into HLists and Disiunctiones.
labelled
This module holds the machinery behind NominataUniversalis.
linear
Linear Types Module - Resource-safe programming with single-use guarantees
metrics
Effect Metrics - Performance Monitoring
nexus
OrdoFP Nexus: Efficient Type-Level Effect System
nonempty
NonEmpty - A non-empty list type.
optics
Optics for OrdoFP
par
ParFlumen — bulk, data-parallel collection semantics.
path
Holds models, traits, and logic for Universalis traversal of models
pfds
Persistent Functional Data Structures (PFDS)
prelude
OrdoFP Prelude
quantitative
Quantitative Types Module - Type-level multiplicity tracking
recursion
Recursion Schemes - Structured recursion combinators.
refined
Refinement Types
rows
Row Polymorphism - Extensible Records and Variants
specialization
Compile-Time Specialization Hints
supervision
Supervision Trees - Structured Fault Tolerance
tailrec
Tail recursion optimization for stack-safe recursive computations.
tracing
Effect Tracing - Causal Observability
traits
Traits that provide Universalis functionality for multiple types in ordofp
transformers
Monad Transformers for composing monadic effects.
traversable
Traversable type class for effectful iteration.
typeclasses
Type classes for algebraic structures and higher-kinded type simulation.
universalis
This module holds the machinery behind Universalis.
validated
Applicative Probatum with error accumulation.
vernacular
Vernacular API - English Aliases for OrdoFP
wrappers
Wrapper types for alternative Compositio/Unitas behaviors.
zipper
Zipper: A cursor into a list with cheap focus operations

Macros§

Disiunctio
Returns a type signature for a Disiunctio of the provided types.
HList
Returns a type signature for an HList of the provided types
assert_align
Assert that a type has a specific alignment at compile time.
assert_size
Assert that a type has a specific size at compile time.
assert_zst
Assert that a type is zero-sized at compile time.
chain_async
Chain async functions from left to right, returning a composed function.
cold_panic
A cold-path panic that ensures the panic logic is out-of-line.
cold_path
Mark a function as cold (rarely called).
compose
Compose functions from right to left.
compose_async
Compose async functions from right to left.
coniunctio_pat
Macro for pattern-matching on HLists.
constant
Create a constant function that ignores its argument.
curry2
Curry a function of 2 arguments.
curry3
Curry a function of 3 arguments.
effect_row
Macro for creating effect row types.
field
Used for creating a Field
flip
Flip the arguments of a binary function.
functio_poly
Returns a polymorphic function for use with mapping/folding heterogeneous types.
hlist
Returns an HList based on the values passed in.
mdo
Monadic do-notation for composing monadic operations.
mdo_async
Async monadic do-notation for composing async monadic operations.
nonempty
Macro for creating NonEmpty lists.
pipe
Pipe a value through a series of functions from left to right.
pipe_async
Pipe a value through a series of async functions from left to right.
unlikely_panic
A panic that is marked as unlikely and cold.
wrap_pure
Foundation for all FFI wrappers. Defines the basic structure and pointer management.
wrap_ref
Defines a non-owning reference wrapper for a FFI type.