Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Pretty printing with class
Synopsis
- class Pretty a where
- render :: Pretty a => a -> String
- render80 :: Pretty a => a -> String
- renderStyle :: Pretty a => Style -> a -> String
- ($$) :: (Pretty a1, Pretty a2) => a1 -> a2 -> Doc
- ($+$) :: (Pretty a1, Pretty a2) => a1 -> a2 -> Doc
- (<+>) :: (Pretty a1, Pretty a2) => a1 -> a2 -> Doc
- (<>) :: (Pretty a1, Pretty a2) => a1 -> a2 -> Doc
- braces :: Pretty a => a -> Doc
- brackets :: Pretty a => a -> Doc
- cat :: Pretty a => [a] -> Doc
- doubleQuotes :: Pretty a => a -> Doc
- fcat :: Pretty a => [a] -> Doc
- fsep :: Pretty a => [a] -> Doc
- hang :: (Pretty a1, Pretty a2) => a1 -> Int -> a2 -> Doc
- hcat :: Pretty a => [a] -> Doc
- hsep :: Pretty a => [a] -> Doc
- nest :: Pretty a => Int -> a -> Doc
- parens :: Pretty a => a -> Doc
- punctuate :: (Pretty a1, Pretty a2) => a1 -> [a2] -> [Doc]
- quotes :: Pretty a => a -> Doc
- sep :: Pretty a => [a] -> Doc
- vcat :: Pretty a => [a] -> Doc
- data Mode
- data Style = Style {
- mode :: Mode
- lineLength :: Int
- ribbonsPerLine :: Float
- style :: Style
- data Doc
- empty :: Doc
- isEmpty :: Doc -> Bool
Documentation
Instances
doubleQuotes :: Pretty a => a -> Doc Source #
Rendering mode.
PageMode | Normal rendering ( |
ZigZagMode | With zig-zag cuts. |
LeftMode | No indentation, infinitely long lines ( |
OneLineMode | All on one line, |
Instances
Eq Mode | |
Show Mode | |
Generic Mode | |
type Rep Mode | |
Defined in Text.PrettyPrint.Annotated.HughesPJ type Rep Mode = D1 ('MetaData "Mode" "Text.PrettyPrint.Annotated.HughesPJ" "pretty-1.1.3.6" 'False) ((C1 ('MetaCons "PageMode" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ZigZagMode" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "LeftMode" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "OneLineMode" 'PrefixI 'False) (U1 :: Type -> Type))) |
A rendering style. Allows us to specify constraints to choose among the many different rendering options.
Style | |
|
Instances
Eq Style | |
Show Style | |
Generic Style | |
type Rep Style | |
Defined in Text.PrettyPrint.Annotated.HughesPJ type Rep Style = D1 ('MetaData "Style" "Text.PrettyPrint.Annotated.HughesPJ" "pretty-1.1.3.6" 'False) (C1 ('MetaCons "Style" 'PrefixI 'True) (S1 ('MetaSel ('Just "mode") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Mode) :*: (S1 ('MetaSel ('Just "lineLength") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "ribbonsPerLine") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Float)))) |
The abstract type of documents. A Doc represents a set of layouts. A Doc with no occurrences of Union or NoDoc represents just one layout.