diff options
Diffstat (limited to 'src/AST/Pretty.hs')
-rw-r--r-- | src/AST/Pretty.hs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/AST/Pretty.hs b/src/AST/Pretty.hs index 76424fe..bac267d 100644 --- a/src/AST/Pretty.hs +++ b/src/AST/Pretty.hs @@ -14,7 +14,9 @@ import Data.Functor.Const import AST import AST.Count +import CHAD.Types import Data +import ForwardAD.DualNumbers.Types type SVal = SList (Const String) @@ -175,6 +177,21 @@ ppExpr' d val = \case (Prefix, s) -> s return $ showParen (d > 10) $ showString (ops ++ " ") . e' + ECustom _ t1 t2 a b c e1 e2 -> do + pn1 <- genNameIfUsedIn t1 (IS IZ) a + pn2 <- genNameIfUsedIn t2 IZ a + fn1 <- genNameIfUsedIn t1 (IS IZ) b + fn2 <- genNameIfUsedIn (dn t2) IZ b + rn1 <- genNameIfUsedIn (d1 t1) (IS (IS IZ)) c + rn2 <- genNameIfUsedIn (d1 t2) (IS IZ) c + rn3 <- genNameIfUsedIn' "d" (d2 (typeOf a)) IZ c + a' <- ppExpr' 11 (Const pn2 `SCons` Const pn1 `SCons` SNil) a + b' <- ppExpr' 11 (Const fn2 `SCons` Const fn1 `SCons` SNil) b + c' <- ppExpr' 11 (Const rn3 `SCons` Const rn2 `SCons` Const rn1 `SCons` SNil) c + e1' <- ppExpr' 11 val e1 + e2' <- ppExpr' 11 val e2 + return $ showParen (d > 10) $ showString "custom " . a' . showString " " . b' . showString " " . c' . showString " " . e1' . showString " " . e2' + EWith e1 e2 -> do e1' <- ppExpr' 11 val e1 name <- genNameIfUsedIn' "ac" (STAccum (typeOf e1)) IZ e2 |