File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ instance Pretty (Statement a) where
6565 else indented 3 alt
6666 SwitchStmt _ e cases ->
6767 text " switch" <+> parens (ppExpression True e) <> line <>
68- braces (nest 3 (vcat (map prettyPrint cases) ))
68+ ppBlock 2 (vcat (map prettyPrint cases))
6969 WhileStmt _ test body -> text " while" <+> parens (ppExpression True test) </>
7070 indented 3 body
7171 ReturnStmt _ Nothing -> text " return" <> semi
@@ -259,7 +259,10 @@ inBlock s = asBlock [s]
259259
260260asBlock :: [Statement a ] -> Doc
261261asBlock [] = lbrace <$$> rbrace
262- asBlock ss = lbrace <> nest 3 (line <> prettyPrint ss) <$$> rbrace
262+ asBlock ss = ppBlock 3 (prettyPrint ss)
263+
264+ ppBlock :: Int -> Doc -> Doc
265+ ppBlock width doc = lbrace <> nest width (line <> doc) <$$> rbrace
263266
264267ppVarDecl :: Bool -> VarDecl a -> Doc
265268ppVarDecl hasIn vd = case vd of
You can’t perform that action at this time.
0 commit comments