Copyright | (c) 2009 Bernie Pope |
---|---|
License | BSD-style |
Maintainer | bjpop@csse.unimelb.edu.au |
Stability | experimental |
Portability | ghc |
Safe Haskell | Safe |
Language | Haskell2010 |
Language.Python.Common.Pretty
Description
Convenience class for pretty printing combinators.
Synopsis
- class Pretty a where
- pretty :: a -> Doc
- prettyText :: Pretty a => a -> String
- prettyPrefix :: Pretty a => Int -> a -> Doc
- parensIf :: Pretty a => (a -> Bool) -> a -> Doc
- perhaps :: Pretty a => Maybe a -> Doc -> Doc
- commaList :: Pretty a => [a] -> Doc
- equalsList :: Pretty a => [a] -> Doc
Documentation
All types which can be transformed into a Doc
.
Instances
prettyText :: Pretty a => a -> String Source #
Transform values into strings.
prettyPrefix :: Pretty a => Int -> a -> Doc Source #
Print just the prefix of something
parensIf :: Pretty a => (a -> Bool) -> a -> Doc Source #
Conditionally wrap parentheses around an item.
equalsList :: Pretty a => [a] -> Doc Source #
A list of things separated by equals signs.