diff options
author | Tom Smeding <t.j.smeding@uu.nl> | 2025-03-20 18:32:22 +0100 |
---|---|---|
committer | Tom Smeding <t.j.smeding@uu.nl> | 2025-03-20 18:32:22 +0100 |
commit | d030802dd6d960afa80ac84a5580a46d39c02822 (patch) | |
tree | 0c40e8eea6fe12cab0bd74e5e4f457e13bbf9afd /src/AST/Pretty.hs | |
parent | 146a846f799f63cd98eee2149c417686adba17a9 (diff) |
Commutativity marker on fold1i
Diffstat (limited to 'src/AST/Pretty.hs')
-rw-r--r-- | src/AST/Pretty.hs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/AST/Pretty.hs b/src/AST/Pretty.hs index b9406d7..527a7ca 100644 --- a/src/AST/Pretty.hs +++ b/src/AST/Pretty.hs @@ -150,14 +150,16 @@ ppExpr' d val expr = case expr of <> hardline <> e') (ppApp (annotate AHighlight (ppString "build") <> ppX expr) [a', ppLam [ppString name] e']) - EFold1Inner _ a b c -> do + EFold1Inner _ cm a b c -> do name1 <- genNameIfUsedIn (typeOf a) (IS IZ) a name2 <- genNameIfUsedIn (typeOf a) IZ a a' <- ppExpr' 0 (Const name2 `SCons` Const name1 `SCons` val) a b' <- ppExpr' 11 val b c' <- ppExpr' 11 val c + let opname = case cm of Commut -> "fold1i(C)" + Noncommut -> "fold1i" return $ ppParen (d > 10) $ - ppApp (annotate AHighlight (ppString "fold1i") <> ppX expr) [ppLam [ppString name1, ppString name2] a', b', c'] + ppApp (annotate AHighlight (ppString opname) <> ppX expr) [ppLam [ppString name1, ppString name2] a', b', c'] ESum1Inner _ e -> do e' <- ppExpr' 11 val e |