diff options
author | Tom Smeding <t.j.smeding@uu.nl> | 2025-01-27 15:08:02 +0100 |
---|---|---|
committer | Tom Smeding <t.j.smeding@uu.nl> | 2025-01-27 15:08:02 +0100 |
commit | 88fae8c2914b805a733b71de58ab672124e6069c (patch) | |
tree | c155fb1a83ace92aab376202ebc8b4b8a919da7c /src/CHAD.hs | |
parent | 0bdc36d221703e5a2347d3d136d676a86bdb1b6a (diff) |
Add ext field to remaining AST constructors
Diffstat (limited to 'src/CHAD.hs')
-rw-r--r-- | src/CHAD.hs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/CHAD.hs b/src/CHAD.hs index aa5bd4c..6118e48 100644 --- a/src/CHAD.hs +++ b/src/CHAD.hs @@ -319,10 +319,10 @@ indexTupD1Id (SS n) | Refl <- indexTupD1Id n = Refl ------------------------------------ MONOIDS ----------------------------------- zero :: STy t -> Ex env (D2 t) -zero = EZero +zero = EZero ext plus :: STy t -> Ex env (D2 t) -> Ex env (D2 t) -> Ex env (D2 t) -plus = EPlus +plus = EPlus ext zeroTup :: SList STy env0 -> Ex env (Tup (D2E env0)) zeroTup SNil = ENil ext @@ -594,7 +594,7 @@ drev des = \case SETop (EVar ext (d1 t) (conv1Idx i)) (subenvNone (select SMerge des)) - (EAccum SZ (ENil ext) (EVar ext (d2 t) IZ) (EVar ext (STAccum (d2 t)) (IS accI))) + (EAccum ext SZ (ENil ext) (EVar ext (d2 t) IZ) (EVar ext (STAccum (d2 t)) (IS accI))) Idx2Me tupI -> Ret BTop @@ -689,7 +689,7 @@ drev des = \case (zeroTup (subList (select SMerge des) sub)) (ECase ext (EVar ext (STEither (d2 (typeOf e)) (d2 t2)) IZ) (weakenExpr (WCopy (wSinks' @[_,_])) e2) - (EError (tTup (d2e (subList (select SMerge des) sub))) "inl<-dinr")) + (EError ext (tTup (d2e (subList (select SMerge des) sub))) "inl<-dinr")) (EVar ext (STMaybe (STEither (d2 (typeOf e)) (d2 t2))) IZ)) EInr _ t1 e @@ -701,7 +701,7 @@ drev des = \case (EMaybe ext (zeroTup (subList (select SMerge des) sub)) (ECase ext (EVar ext (STEither (d2 t1) (d2 (typeOf e))) IZ) - (EError (tTup (d2e (subList (select SMerge des) sub))) "inr<-dinl") + (EError ext (tTup (d2e (subList (select SMerge des) sub))) "inr<-dinl") (weakenExpr (WCopy (wSinks' @[_,_])) e2)) (EVar ext (STMaybe (STEither (d2 t1) (d2 (typeOf e)))) IZ)) @@ -820,10 +820,10 @@ drev des = \case (ELet ext (weakenExpr (WCopy (WCopy WClosed)) du) $ weakenExpr (WCopy (WSink .> WSink)) b2) - EError t s -> + EError _ t s -> Ret BTop SETop - (EError (d1 t) s) + (EError ext (d1 t) s) (subenvNone (select SMerge des)) (ENil ext) @@ -922,8 +922,8 @@ drev des = \case subtape (EReplicate1Inner ext en1 e1) sub - (ELet ext (EFold1Inner ext (EPlus eltty (EVar ext (d2 eltty) (IS IZ)) (EVar ext (d2 eltty) IZ)) - (EZero eltty) + (ELet ext (EFold1Inner ext (EPlus ext eltty (EVar ext (d2 eltty) (IS IZ)) (EVar ext (d2 eltty) IZ)) + (EZero ext eltty) (EVar ext (STArr (SS ndim) (d2 eltty)) IZ)) $ weakenExpr (WCopy WSink) e2) @@ -970,7 +970,7 @@ drev des = \case (EIdx ext (EVar ext (STArr n (d1 eltty)) (IS (IS IZ))) (EVar ext (tTup (sreplicate n tIx)) IZ)) sub - (ELet ext (EOneHot (STArr n eltty) n + (ELet ext (EOneHot ext (STArr n eltty) n (arrIdxToAcIdx (d2 eltty) n $ EVar ext tIxN (IS IZ)) (case n of SZ -> EUnit ext (EVar ext (d2 eltty) IZ) SS{} | Refl <- lemAcValArrN (d2 eltty) n -> @@ -1042,7 +1042,7 @@ drev des = \case (EIdx ext (EVar ext at (IS (IS (IS IZ)))) (EVar ext tIxN IZ)) (EIdx ext (EVar ext at' (IS (IS IZ))) (EFst ext (EVar ext tIxN IZ)))))) (EIdx ext (EVar ext (d2 at') (IS (IS IZ))) (EFst ext (EVar ext tIxN (IS IZ)))) - (EZero t)) $ + (EZero ext t)) $ weakenExpr (WCopy (WSink .> WSink .> WSink)) e2) data ChosenStorage = forall s. ((s == "discr") ~ False) => ChosenStorage (Storage s) @@ -1073,10 +1073,10 @@ drevScoped des argty argsto expr SMerge -> case sub of SEYes sub' -> RetScoped e0 subtape e1 sub' e2 - SENo sub' -> RetScoped e0 subtape e1 sub' (EPair ext e2 (EZero argty)) + SENo sub' -> RetScoped e0 subtape e1 sub' (EPair ext e2 (EZero ext argty)) SAccum -> RetScoped e0 subtape e1 sub $ - EWith (EZero argty) $ + EWith ext (EZero ext argty) $ weakenExpr (autoWeak (#d (auto1 @(D2 t)) &. #body (subList (bindingsBinds e0) subtape) &. #ac (auto1 @(TAccum (D2 a))) |