From 955af83f664639701fdbee54718186e07b31d42f Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Tue, 28 Oct 2025 11:56:40 +0100 Subject: Better fold D{1,2} primitives --- src/AST/SplitLets.hs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/AST/SplitLets.hs') 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 -- cgit v1.2.3-70-g09d2