From 3bb0ddec78194ebc1c133f8dcaf1ff83b873d320 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Thu, 23 Oct 2025 23:44:49 +0200 Subject: pipeline helpers in Example --- src/Example.hs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/Example.hs') diff --git a/src/Example.hs b/src/Example.hs index bccc8de..2c51291 100644 --- a/src/Example.hs +++ b/src/Example.hs @@ -11,6 +11,7 @@ module Example where import Array import AST +import AST.Count import AST.Pretty import AST.UnMonoid import CHAD @@ -28,6 +29,22 @@ import Example.Types -- ppExpr senv5 $ simplifyN 20 $ let d = descr5 SMerge SMerge in freezeRet d (drev d ex5) (EConst ext STF32 1.0) +pipeline :: KnownEnv env => CHADConfig -> Ex env t -> Ex (D2 t : env) (TPair t (Tup (D2E env))) +pipeline config term + | Dict <- styKnown (d2 (typeOf term)) = + simplifyFix $ pruneExpr knownEnv $ + simplifyFix $ unMonoid $ + chad' config knownEnv $ + simplifyFix $ + term + +-- :seti -XOverloadedLabels -XPartialTypeSignatures -Wno-partial-type-signatures +pipeline' :: KnownEnv env => CHADConfig -> Ex env t -> IO () +pipeline' config term + | Dict <- styKnown (d2 (typeOf term)) = + pprintExpr (pipeline config term) + + bin :: SOp (TPair a b) c -> Ex env a -> Ex env b -> Ex env c bin op a b = EOp ext op (EPair ext a b) -- cgit v1.2.3-70-g09d2