From 76917de6d801e3667cdf3f1bbbb5c2bceabdecb6 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Sun, 22 Sep 2024 23:16:27 +0200 Subject: Add some missing cases --- src/AST/Pretty.hs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/AST/Pretty.hs') diff --git a/src/AST/Pretty.hs b/src/AST/Pretty.hs index f5e681a..7f60db1 100644 --- a/src/AST/Pretty.hs +++ b/src/AST/Pretty.hs @@ -92,6 +92,21 @@ ppExpr' d val = \case showString "case " . e' . showString (" of { Inl " ++ name1 ++ " -> ") . a' . showString (" ; Inr " ++ name2 ++ " -> ") . b' . showString " }" + ENothing _ _ -> return $ showString "nothing" + + EJust _ e -> do + e' <- ppExpr' 11 val e + return $ showParen (d > 10) $ showString "Just " . e' + + EMaybe _ a b e -> do + let STMaybe t = typeOf e + a' <- ppExpr' 11 val a + name <- genNameIfUsedIn t IZ b + b' <- ppExpr' 11 (Const name `SCons` val) b + e' <- ppExpr' 11 val e + return $ showParen (d > 10) $ + showString "maybe " . a' . showString " " . b' . showString " " . e' + EConstArr _ _ ty v | Dict <- scalRepIsShow ty -> return $ showsPrec d v -- cgit v1.2.3-70-g09d2