From fff6beda3523abce3d27037ea2fb020fce31f502 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Fri, 14 Mar 2025 23:29:51 +0100 Subject: Much process with accumulator revamp --- src/AST.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/AST.hs') diff --git a/src/AST.hs b/src/AST.hs index 3fb8822..1cdd710 100644 --- a/src/AST.hs +++ b/src/AST.hs @@ -88,8 +88,8 @@ data Expr x env t where -> Expr x env t -- accumulation effect on monoids - EWith :: x (TPair a (D2 t)) -> STy t -> Expr x env (D2 t) -> Expr x (TAccum (D2 t) : env) a -> Expr x env (TPair a (D2 t)) - EAccum :: x TNil -> STy t -> SAcPrj p t a -> Expr x env (AcIdx p t) -> Expr x env (D2 a) -> Expr x env (TAccum (D2 a)) -> Expr x env TNil + EWith :: x (TPair a (D2 t)) -> STy t -> Expr x env (D2 t) -> Expr x (TAccum t : env) a -> Expr x env (TPair a (D2 t)) + EAccum :: x TNil -> STy t -> SAcPrj p t a -> Expr x env (AcIdx p t) -> Expr x env (D2 a) -> Expr x env (TAccum t) -> Expr x env TNil -- monoidal operations (to be desugared to regular operations after simplification) EZero :: x (D2 t) -> STy t -> Expr x env (D2 t) @@ -381,6 +381,8 @@ ebuildUp1 n sh size f = eidxEq :: SNat n -> Ex env (Tup (Replicate n TIx)) -> Ex env (Tup (Replicate n TIx)) -> Ex env (TScal TBool) eidxEq SZ _ _ = EConst ext STBool True +eidxEq (SS SZ) a b = + EOp ext (OEq STI64) (EPair ext (ESnd ext a) (ESnd ext b)) eidxEq (SS n) a b | let ty = tTup (sreplicate (SS n) tIx) = ELet ext a $ -- cgit v1.2.3-70-g09d2