Dedekind 0.0.0
A structuralist C++23 Module Library
Loading...
Searching...
No Matches
dedekind::category::detail_kleisli Namespace Reference

Classes

struct  StepAt
 The step at one element, a Kleisli arrow \(A \to T(A)\). More...
struct  Extending
 A fold step on \(T(A)\): the step at the element, by κ. More...
struct  Halved
 A witness's step that may fail: half of an even count. More...

Concepts

concept  IsKleisliStep
 A step from A and an element into TA, the monad on A.

Functions

template<typename MA, IsArrow F>
requires requires { typename functor_of_t<MA>; } && std::same_as<Dom<F>, typename functor_of_t<MA>::Σ_cat::Species>
constexpr auto lifted (const MA &ma, F f)
 \(T(f)\) applied to ma: the arrow f, from the value's element, under T's action, at the value.

Detailed Description

The fold in the Kleisli category

A step that may fail, \(A \times X \to T(A)\), folds a range from \(a : T(A)\): at each element, the step there as a Kleisli arrow \(A \to T(A)\), extended by κ, so a hole passes through to the end and no step cases on it (Haskell's foldM).

Function Documentation

◆ lifted()

template<typename MA, IsArrow F>
requires requires { typename functor_of_t<MA>; } && std::same_as<Dom<F>, typename functor_of_t<MA>::Σ_cat::Species>
auto dedekind::category::detail_kleisli::lifted ( const MA & ma,
F f )
constexpr

\(T(f)\) applied to ma: the arrow f, from the value's element, under T's action, at the value.

Parameters
mathe value.
fthe arrow.