From 20f7d7be13cd7869b338f98d1ab3fd33e8bbfb3e Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Thu, 27 Nov 2025 21:30:17 +0100 Subject: WIP user-specified custom types The big roadblock encountered is that accumulation wants addition of monoids to be elementwise float addition; this fundamentally clashes with the concept of a user type with a custom zero and plus. --- src/CHAD/AST/SplitLets.hs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/CHAD/AST/SplitLets.hs') diff --git a/src/CHAD/AST/SplitLets.hs b/src/CHAD/AST/SplitLets.hs index 34267e4..75c70ea 100644 --- a/src/CHAD/AST/SplitLets.hs +++ b/src/CHAD/AST/SplitLets.hs @@ -79,6 +79,8 @@ splitLets' = \sub -> \case EPlus x t a b -> EPlus x t (splitLets' sub a) (splitLets' sub b) EOneHot x t p a b -> EOneHot x t p (splitLets' sub a) (splitLets' sub b) EError x t s -> EError x t s + EUser x t e -> EUser x t (splitLets' sub e) + EUnUser x e -> EUnUser x (splitLets' sub e) where sinkF :: (forall a env2. STy a -> Idx env a -> env' :> env2 -> Ex env2 a) -> STy t -> Idx (b : env) t -> (b : env') :> env3 -> Ex env3 t @@ -167,6 +169,7 @@ split typ = case typ of STArr{} -> other STScal{} -> other STAccum{} -> other + STUser{} -> other where other :: (Pointers (t : env) t, Bindings Ex (t : env) '[]) other = (Point typ IZ, BTop) @@ -186,6 +189,7 @@ splitRec rhs typ = case typ of STArr{} -> other STScal{} -> other STAccum{} -> other + STUser{} -> other where other :: (Pointers (t : env) t, Bindings Ex env '[t]) other = (Point typ IZ, BPush BTop (typ, rhs)) -- cgit v1.2.3-70-g09d2