Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Pretty doc = Pretty {}
- ppExpr :: Pretty doc -> Expr -> doc
- ppEditExpr :: Pretty doc -> Edit EditExpr -> doc
- ppEditExprCompact :: Pretty doc -> Edit EditExpr -> doc
- prettyPretty :: Pretty Doc
- prettyExpr :: Expr -> Doc
- prettyEditExpr :: Edit EditExpr -> Doc
- prettyEditExprCompact :: Edit EditExpr -> Doc
- ansiWlPretty :: Pretty Doc
- ansiWlExpr :: Expr -> Doc
- ansiWlEditExpr :: Edit EditExpr -> Doc
- ansiWlEditExprCompact :: Edit EditExpr -> Doc
- ansiWlBgPretty :: Pretty Doc
- ansiWlBgExpr :: Expr -> Doc
- ansiWlBgEditExpr :: Edit EditExpr -> Doc
- ansiWlBgEditExprCompact :: Edit EditExpr -> Doc
- escapeName :: String -> String
Explicit dictionary
Because we don't want to commit to single pretty printing library, we use explicit dictionary.
ppExpr :: Pretty doc -> Expr -> doc Source #
Pretty print an Expr
using explicit pretty-printing dictionary.
ppEditExprCompact :: Pretty doc -> Edit EditExpr -> doc Source #
Like ppEditExpr
but print unchanged parts only shallowly
pretty
prettyExpr :: Expr -> Doc Source #
Pretty print Expr
using pretty
.
>>>
prettyExpr $ Rec "ex" (Map.fromList [("[]", App "bar" [])])
ex {`[]` = bar}
prettyEditExprCompact :: Edit EditExpr -> Doc Source #
Compact prettyEditExpr
.
ansi-wl-pprint
ansiWlEditExprCompact :: Edit EditExpr -> Doc Source #
Compact ansiWlEditExpr
background
ansiWlBgPretty :: Pretty Doc Source #
Like ansiWlPretty
but color the background.
ansiWlBgEditExprCompact :: Edit EditExpr -> Doc Source #
Compact ansiWlBgEditExpr
.
Utilities
escapeName :: String -> String Source #
Escape field or constructor name
>>>
putStrLn $ escapeName "Foo"
Foo
>>>
putStrLn $ escapeName "_×_"
_×_
>>>
putStrLn $ escapeName "-3"
`-3`
>>>
putStrLn $ escapeName "kebab-case"
kebab-case
>>>
putStrLn $ escapeName "inner space"
`inner space`
>>>
putStrLn $ escapeName $ show "looks like a string"
"looks like a string"
>>>
putStrLn $ escapeName $ show "tricky" ++ " "
`"tricky" `
>>>
putStrLn $ escapeName "[]"
`[]`
>>>
putStrLn $ escapeName "_,_"
`_,_`