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
/*
* SPDX-License-Identifier: MIT
* Copyright (c) 2023 - 2026. The DeepCausality Authors and Contributors. All Rights Reserved.
*/
use crateCausalTensor;
use crateStrictCausalTensorWitness;
use ;
// **Strict GAT HKTs are Solved in the Next-Generation Trait Solver**
//
// As of **January 2026**, we have confirmed that the inability to implement strict `Monad` and `CoMonad`
// (due to `E0276`/ `E0277` GAT normalization errors) is a **temporary limitation** of the current stable Rust trait solver.
//
/*
#[test]
fn test_strict_monad_bind() {
let tensor = CausalTensor::from_vec(vec![1.0, 2.0, 3.0], &[3]);
let result = StrictCausalTensorWitness::bind(tensor, |x| {
StrictCausalTensorWitness::pure(x * 2.0)
});
// Expected result: [2.0, 4.0, 6.0] (List Monad behavior)
assert_eq!(result.shape(), &[3]);
assert_eq!(result.as_slice(), &[2.0, 4.0, 6.0]);
}
#[test]
fn test_strict_comonad_extend() {
let tensor = CausalTensor::from_vec(vec![1.0, 2.0, 3.0], &[3]);
// Extend with sum
let result = StrictCausalTensorWitness::extend(&tensor, |t: &CausalTensor<_>| {
StrictCausalTensorWitness::fold(t.clone(), 0.0, |acc, x| acc + x)
});
// For list comonad (shifted view), extend(sum) usually gives suffix sums or similar depending on implementation
// Implementation uses shifted_view(i), so for [1, 2, 3]:
// i=0: view=[1, 2, 3], sum=6
// i=1: view=[2, 3], sum=5
// i=2: view=[3], sum=3
assert_eq!(result.as_slice(), &[6.0, 5.0, 3.0]);
}
*/