aboutsummaryrefslogtreecommitdiff
path: root/src/AST/SplitLets.hs
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2025-10-28 11:56:40 +0100
committerTom Smeding <tom@tomsmeding.com>2025-10-28 11:56:40 +0100
commit955af83f664639701fdbee54718186e07b31d42f (patch)
tree30353d77c69b1dfdaf43797942dbf6e412a49450 /src/AST/SplitLets.hs
parent765b80616583322226284266605ab3a916da01db (diff)
Better fold D{1,2} primitives
Diffstat (limited to 'src/AST/SplitLets.hs')
-rw-r--r--src/AST/SplitLets.hs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/AST/SplitLets.hs b/src/AST/SplitLets.hs
index f75e795..6034084 100644
--- a/src/AST/SplitLets.hs
+++ b/src/AST/SplitLets.hs
@@ -38,10 +38,10 @@ splitLets' = \sub -> \case
EFold1InnerD1 x cm a b c ->
let STArr _ t1 = typeOf c
in EFold1InnerD1 x cm (split2 sub t1 t1 a) (splitLets' sub b) (splitLets' sub c)
- EFold1InnerD2 x cm t2 a b c d e ->
- let STArr _ t1 = typeOf b
- STArr _ (STPair _ ttape) = typeOf d
- in EFold1InnerD2 x cm t2 (split4 sub ttape t1 t1 (fromSMTy t2) a) (splitLets' sub b) (splitLets' sub c) (splitLets' sub d) (splitLets' sub e)
+ EFold1InnerD2 x cm a b c d e ->
+ let t2 = typeOf b
+ STArr _ tB = typeOf d
+ in EFold1InnerD2 x cm (split2 sub tB t2 a) (splitLets' sub b) (split2 sub t2 t2 c) (splitLets' sub d) (splitLets' sub e)
EPair x a b -> EPair x (splitLets' sub a) (splitLets' sub b)
EFst x e -> EFst x (splitLets' sub e)
@@ -106,10 +106,10 @@ splitLets' = \sub -> \case
body
-- TODO: abstract this to splitN lol wtf
- split4 :: forall bind1 bind2 bind3 bind4 env' env t.
- (forall a env2. STy a -> Idx env a -> env' :> env2 -> Ex env2 a)
- -> STy bind1 -> STy bind2 -> STy bind3 -> STy bind4 -> Ex (bind4 : bind3 : bind2 : bind1 : env) t -> Ex (bind4 : bind3 : bind2 : bind1 : env') t
- split4 sub tbind1 tbind2 tbind3 tbind4 body =
+ _split4 :: forall bind1 bind2 bind3 bind4 env' env t.
+ (forall a env2. STy a -> Idx env a -> env' :> env2 -> Ex env2 a)
+ -> STy bind1 -> STy bind2 -> STy bind3 -> STy bind4 -> Ex (bind4 : bind3 : bind2 : bind1 : env) t -> Ex (bind4 : bind3 : bind2 : bind1 : env') t
+ _split4 sub tbind1 tbind2 tbind3 tbind4 body =
let (ptrs1, bs1') = split @env' tbind1
(ptrs2, bs2') = split @(bind1 : env') tbind2
(ptrs3, bs3') = split @(bind2 : bind1 : env') tbind3