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
/*
* SPDX-License-Identifier: MIT
* Copyright (c) 2023 - 2026. The DeepCausality Authors and Contributors. All Rights Reserved.
*/
use crate::;
/// The `Pure` trait provides the ability to lift a value into a context.
///
/// This is the fundamental "return" or "unit" operation in category theory,
/// representing the natural transformation η: Id → F.
///
/// # Design Rationale
///
/// `Pure` is extracted as a separate trait to enable:
/// - `Applicative: Functor + Pure` (for `apply` operations)
/// - `Monad: Functor + Pure` (for `bind` operations)
///
/// This allows `Monad` to be implemented without requiring `Applicative`,
/// which is blocked for strict constrained witnesses due to the
/// `Func: Satisfies<F::Constraint>` requirement in `Applicative::apply`.
///
/// # Constraint Support
///
/// The `pure` function requires the value type to satisfy the HKT's constraint.
/// This ensures type-safe lifting for constrained types like `CausalTensor<T>`
/// where `T: TensorData`.
///
/// # Type Parameters
///
/// * `F`: A Higher-Kinded Type (HKT) witness that represents the type constructor
/// (e.g., `OptionWitness`, `VecWitness`, `CausalTensorWitness`).