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
/*
* SPDX-License-Identifier: MIT
* Copyright (c) 2023 - 2026. The DeepCausality Authors and Contributors. All Rights Reserved.
*/
use crateHKT2Unbound;
/// The explicit typed-arrow base: a family of arrows `P::Type<A, B>` (think `A → B`)
/// with an identity arrow and the ability to apply an arrow to an input.
///
/// # Category Theory
///
/// `Morphism` is the object/arrow interface of a category: every discovery operator
/// (and, later, every stage of the Causal Arrow) instances it. It is parameterized by a
/// two-argument HKT witness `P: HKT2Unbound`, so the concrete carrier of an arrow is the
/// witness's `Type<A, B>`.
///
/// # Why there is no `compose` here
///
/// General arrow composition `P::Type<A, B>` with `P::Type<B, C>` into `P::Type<A, C>`
/// over *capturing* closures has no single concrete carrier under the repo's
/// `unsafe_code = "forbid"` / no-`dyn` policy (closures are unnameable unique types, and
/// `Box<dyn Fn>` is a forbidden trait object). Identity plus application is the honest,
/// implementable base, and it is enough to host the iteration combinators on
/// [`Endomorphism`](crate::Endomorphism).
/// The canonical function-pointer carrier for [`Morphism`]: an arrow `A → B` is a plain
/// `fn(A) -> B`.
///
/// Fully static, zero-capture, and free of `dyn`/trait objects. It covers any rule
/// expressible as a non-capturing function (for example the BRCD Meek pass, which reads
/// and writes only the graph). Rules that must capture configuration get a dedicated
/// carrier when a real call site needs one.
;