summaryrefslogtreecommitdiff
path: root/src/Data.hs
diff options
context:
space:
mode:
authorTom Smeding <t.j.smeding@uu.nl>2025-03-07 15:11:59 +0100
committerTom Smeding <tom@tomsmeding.com>2025-03-14 15:37:29 +0100
commit137eaa13144c2599ac29da9ebd3af24ac1ce8968 (patch)
tree8fc5221824f671dfc27f8064e3fc537859bb73e8 /src/Data.hs
parent1abb0c11efd2ba650c0a20de8047efbde2cc6adf (diff)
WIP revamp accumulator projection type repr
I stopped working on this because I realised that having sparse products (and coproducts, prehaps) everywhere is a very bad idea in general, and that we need to fix that first before really being able to do anything else productive with performance.
Diffstat (limited to 'src/Data.hs')
-rw-r--r--src/Data.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Data.hs b/src/Data.hs
index 1304a5f..60afdd0 100644
--- a/src/Data.hs
+++ b/src/Data.hs
@@ -101,6 +101,10 @@ type family n + m where
Z + m = m
S n + m = S (n + m)
+type family n - m where
+ n - Z = n
+ S n - S m = n - m
+
snatAdd :: SNat n -> SNat m -> SNat (n + m)
snatAdd SZ m = m
snatAdd (SS n) m = SS (snatAdd n m)