prettyclass-1.0.0.0: Pretty printing class similar to Show.
Safe HaskellSafe-Inferred
LanguageHaskell98

Text.PrettyPrint.HughesPJClass

Description

Pretty printing class, simlar to Show but nicer looking. Note that the precedence level is a Rational so there is an unlimited number of levels. Based on Text.PrettyPrint.HughesPJ, which is re-exported.

Synopsis

Documentation

class Pretty a where Source #

Pretty printing class. The precedence level is used in a similar way as in the Show class. Minimal complete definition is either pPrintPrec or pPrint.

Minimal complete definition

Nothing

Methods

pPrintPrec :: PrettyLevel -> Rational -> a -> Doc Source #

pPrint :: a -> Doc Source #

pPrintList :: PrettyLevel -> [a] -> Doc Source #

Instances

Instances details
Pretty Ordering Source # 
Instance details

Defined in Text.PrettyPrint.HughesPJClass

Methods

pPrintPrec :: PrettyLevel -> Rational -> Ordering -> Doc Source #

pPrint :: Ordering -> Doc Source #

pPrintList :: PrettyLevel -> [Ordering] -> Doc Source #

Pretty Integer Source # 
Instance details

Defined in Text.PrettyPrint.HughesPJClass

Methods

pPrintPrec :: PrettyLevel -> Rational -> Integer -> Doc Source #

pPrint :: Integer -> Doc Source #

pPrintList :: PrettyLevel -> [Integer] -> Doc Source #

Pretty () Source # 
Instance details

Defined in Text.PrettyPrint.HughesPJClass

Methods

pPrintPrec :: PrettyLevel -> Rational -> () -> Doc Source #

pPrint :: () -> Doc Source #

pPrintList :: PrettyLevel -> [()] -> Doc Source #

Pretty Bool Source # 
Instance details

Defined in Text.PrettyPrint.HughesPJClass

Methods

pPrintPrec :: PrettyLevel -> Rational -> Bool -> Doc Source #

pPrint :: Bool -> Doc Source #

pPrintList :: PrettyLevel -> [Bool] -> Doc Source #

Pretty Char Source # 
Instance details

Defined in Text.PrettyPrint.HughesPJClass

Methods

pPrintPrec :: PrettyLevel -> Rational -> Char -> Doc Source #

pPrint :: Char -> Doc Source #

pPrintList :: PrettyLevel -> [Char] -> Doc Source #

Pretty Double Source # 
Instance details

Defined in Text.PrettyPrint.HughesPJClass

Methods

pPrintPrec :: PrettyLevel -> Rational -> Double -> Doc Source #

pPrint :: Double -> Doc Source #

pPrintList :: PrettyLevel -> [Double] -> Doc Source #

Pretty Float Source # 
Instance details

Defined in Text.PrettyPrint.HughesPJClass

Methods

pPrintPrec :: PrettyLevel -> Rational -> Float -> Doc Source #

pPrint :: Float -> Doc Source #

pPrintList :: PrettyLevel -> [Float] -> Doc Source #

Pretty Int Source # 
Instance details

Defined in Text.PrettyPrint.HughesPJClass

Methods

pPrintPrec :: PrettyLevel -> Rational -> Int -> Doc Source #

pPrint :: Int -> Doc Source #

pPrintList :: PrettyLevel -> [Int] -> Doc Source #

Pretty a => Pretty (Maybe a) Source # 
Instance details

Defined in Text.PrettyPrint.HughesPJClass

Methods

pPrintPrec :: PrettyLevel -> Rational -> Maybe a -> Doc Source #

pPrint :: Maybe a -> Doc Source #

pPrintList :: PrettyLevel -> [Maybe a] -> Doc Source #

Pretty a => Pretty [a] Source # 
Instance details

Defined in Text.PrettyPrint.HughesPJClass

Methods

pPrintPrec :: PrettyLevel -> Rational -> [a] -> Doc Source #

pPrint :: [a] -> Doc Source #

pPrintList :: PrettyLevel -> [[a]] -> Doc Source #

(Pretty a, Pretty b) => Pretty (Either a b) Source # 
Instance details

Defined in Text.PrettyPrint.HughesPJClass

Methods

pPrintPrec :: PrettyLevel -> Rational -> Either a b -> Doc Source #

pPrint :: Either a b -> Doc Source #

pPrintList :: PrettyLevel -> [Either a b] -> Doc Source #

(Pretty a, Pretty b) => Pretty (a, b) Source # 
Instance details

Defined in Text.PrettyPrint.HughesPJClass

Methods

pPrintPrec :: PrettyLevel -> Rational -> (a, b) -> Doc Source #

pPrint :: (a, b) -> Doc Source #

pPrintList :: PrettyLevel -> [(a, b)] -> Doc Source #

(Pretty a, Pretty b, Pretty c) => Pretty (a, b, c) Source # 
Instance details

Defined in Text.PrettyPrint.HughesPJClass

Methods

pPrintPrec :: PrettyLevel -> Rational -> (a, b, c) -> Doc Source #

pPrint :: (a, b, c) -> Doc Source #

pPrintList :: PrettyLevel -> [(a, b, c)] -> Doc Source #

(Pretty a, Pretty b, Pretty c, Pretty d) => Pretty (a, b, c, d) Source # 
Instance details

Defined in Text.PrettyPrint.HughesPJClass

Methods

pPrintPrec :: PrettyLevel -> Rational -> (a, b, c, d) -> Doc Source #

pPrint :: (a, b, c, d) -> Doc Source #

pPrintList :: PrettyLevel -> [(a, b, c, d)] -> Doc Source #

(Pretty a, Pretty b, Pretty c, Pretty d, Pretty e) => Pretty (a, b, c, d, e) Source # 
Instance details

Defined in Text.PrettyPrint.HughesPJClass

Methods

pPrintPrec :: PrettyLevel -> Rational -> (a, b, c, d, e) -> Doc Source #

pPrint :: (a, b, c, d, e) -> Doc Source #

pPrintList :: PrettyLevel -> [(a, b, c, d, e)] -> Doc Source #

(Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f) => Pretty (a, b, c, d, e, f) Source # 
Instance details

Defined in Text.PrettyPrint.HughesPJClass

Methods

pPrintPrec :: PrettyLevel -> Rational -> (a, b, c, d, e, f) -> Doc Source #

pPrint :: (a, b, c, d, e, f) -> Doc Source #

pPrintList :: PrettyLevel -> [(a, b, c, d, e, f)] -> Doc Source #

(Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f, Pretty g) => Pretty (a, b, c, d, e, f, g) Source # 
Instance details

Defined in Text.PrettyPrint.HughesPJClass

Methods

pPrintPrec :: PrettyLevel -> Rational -> (a, b, c, d, e, f, g) -> Doc Source #

pPrint :: (a, b, c, d, e, f, g) -> Doc Source #

pPrintList :: PrettyLevel -> [(a, b, c, d, e, f, g)] -> Doc Source #

(Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f, Pretty g, Pretty h) => Pretty (a, b, c, d, e, f, g, h) Source # 
Instance details

Defined in Text.PrettyPrint.HughesPJClass

Methods

pPrintPrec :: PrettyLevel -> Rational -> (a, b, c, d, e, f, g, h) -> Doc Source #

pPrint :: (a, b, c, d, e, f, g, h) -> Doc Source #

pPrintList :: PrettyLevel -> [(a, b, c, d, e, f, g, h)] -> Doc Source #

newtype PrettyLevel Source #

Level of detail in the pretty printed output. Level 0 is the least detail.

Constructors

PrettyLevel Int 

Instances

Instances details
Show PrettyLevel Source # 
Instance details

Defined in Text.PrettyPrint.HughesPJClass

Methods

showsPrec :: Int -> PrettyLevel -> ShowS

show :: PrettyLevel -> String

showList :: [PrettyLevel] -> ShowS

Eq PrettyLevel Source # 
Instance details

Defined in Text.PrettyPrint.HughesPJClass

Methods

(==) :: PrettyLevel -> PrettyLevel -> Bool

(/=) :: PrettyLevel -> PrettyLevel -> Bool

Ord PrettyLevel Source # 
Instance details

Defined in Text.PrettyPrint.HughesPJClass

prettyShow :: Pretty a => a -> String Source #

Pretty print a value with the prettyNormal level.

prettyParen :: Bool -> Doc -> Doc Source #

Parenthesize an value if the boolean is true.

text :: String -> Doc #

data Doc #

Instances

Instances details
NFData Doc 
Instance details

Defined in Text.PrettyPrint.HughesPJ

Methods

rnf :: Doc -> ()

Monoid Doc 
Instance details

Defined in Text.PrettyPrint.HughesPJ

Methods

mempty :: Doc

mappend :: Doc -> Doc -> Doc

mconcat :: [Doc] -> Doc

Semigroup Doc 
Instance details

Defined in Text.PrettyPrint.HughesPJ

Methods

(<>) :: Doc -> Doc -> Doc

sconcat :: NonEmpty Doc -> Doc

stimes :: Integral b => b -> Doc -> Doc

IsString Doc 
Instance details

Defined in Text.PrettyPrint.HughesPJ

Methods

fromString :: String -> Doc

Generic Doc 
Instance details

Defined in Text.PrettyPrint.HughesPJ

Associated Types

type Rep Doc 
Instance details

Defined in Text.PrettyPrint.HughesPJ

type Rep Doc = D1 ('MetaData "Doc" "Text.PrettyPrint.HughesPJ" "pretty-1.1.3.6-inplace" 'True) (C1 ('MetaCons "Doc" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Doc ()))))

Methods

from :: Doc -> Rep Doc x

to :: Rep Doc x -> Doc

Show Doc 
Instance details

Defined in Text.PrettyPrint.HughesPJ

Methods

showsPrec :: Int -> Doc -> ShowS

show :: Doc -> String

showList :: [Doc] -> ShowS

Eq Doc 
Instance details

Defined in Text.PrettyPrint.HughesPJ

Methods

(==) :: Doc -> Doc -> Bool

(/=) :: Doc -> Doc -> Bool

type Rep Doc 
Instance details

Defined in Text.PrettyPrint.HughesPJ

type Rep Doc = D1 ('MetaData "Doc" "Text.PrettyPrint.HughesPJ" "pretty-1.1.3.6-inplace" 'True) (C1 ('MetaCons "Doc" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Doc ()))))

fsep :: [Doc] -> Doc #

punctuate :: Doc -> [Doc] -> [Doc] #

render :: Doc -> String #

parens :: Doc -> Doc #

int :: Int -> Doc #

integer :: Integer -> Doc #

float :: Float -> Doc #

double :: Double -> Doc #

char :: Char -> Doc #

(<+>) :: Doc -> Doc -> Doc #

(<>) :: Doc -> Doc -> Doc #

($$) :: Doc -> Doc -> Doc #

($+$) :: Doc -> Doc -> Doc #

data TextDetails #

Constructors

Chr !Char 
Str String 
PStr String 

Instances

Instances details
NFData TextDetails 
Instance details

Defined in Text.PrettyPrint.Annotated.HughesPJ

Methods

rnf :: TextDetails -> ()

Generic TextDetails 
Instance details

Defined in Text.PrettyPrint.Annotated.HughesPJ

Associated Types

type Rep TextDetails 
Instance details

Defined in Text.PrettyPrint.Annotated.HughesPJ

type Rep TextDetails = D1 ('MetaData "TextDetails" "Text.PrettyPrint.Annotated.HughesPJ" "pretty-1.1.3.6-inplace" 'False) (C1 ('MetaCons "Chr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedUnpack) (Rec0 Char)) :+: (C1 ('MetaCons "Str" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)) :+: C1 ('MetaCons "PStr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String))))

Methods

from :: TextDetails -> Rep TextDetails x

to :: Rep TextDetails x -> TextDetails

Show TextDetails 
Instance details

Defined in Text.PrettyPrint.Annotated.HughesPJ

Methods

showsPrec :: Int -> TextDetails -> ShowS

show :: TextDetails -> String

showList :: [TextDetails] -> ShowS

Eq TextDetails 
Instance details

Defined in Text.PrettyPrint.Annotated.HughesPJ

Methods

(==) :: TextDetails -> TextDetails -> Bool

(/=) :: TextDetails -> TextDetails -> Bool

type Rep TextDetails 
Instance details

Defined in Text.PrettyPrint.Annotated.HughesPJ

type Rep TextDetails = D1 ('MetaData "TextDetails" "Text.PrettyPrint.Annotated.HughesPJ" "pretty-1.1.3.6-inplace" 'False) (C1 ('MetaCons "Chr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedUnpack) (Rec0 Char)) :+: (C1 ('MetaCons "Str" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)) :+: C1 ('MetaCons "PStr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String))))

data Mode #

Instances

Instances details
Generic Mode 
Instance details

Defined in Text.PrettyPrint.Annotated.HughesPJ

Associated Types

type Rep Mode 
Instance details

Defined in Text.PrettyPrint.Annotated.HughesPJ

type Rep Mode = D1 ('MetaData "Mode" "Text.PrettyPrint.Annotated.HughesPJ" "pretty-1.1.3.6-inplace" '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)))

Methods

from :: Mode -> Rep Mode x

to :: Rep Mode x -> Mode

Show Mode 
Instance details

Defined in Text.PrettyPrint.Annotated.HughesPJ

Methods

showsPrec :: Int -> Mode -> ShowS

show :: Mode -> String

showList :: [Mode] -> ShowS

Eq Mode 
Instance details

Defined in Text.PrettyPrint.Annotated.HughesPJ

Methods

(==) :: Mode -> Mode -> Bool

(/=) :: Mode -> Mode -> Bool

type Rep Mode 
Instance details

Defined in Text.PrettyPrint.Annotated.HughesPJ

type Rep Mode = D1 ('MetaData "Mode" "Text.PrettyPrint.Annotated.HughesPJ" "pretty-1.1.3.6-inplace" '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)))

data Style #

Constructors

Style 

Fields

Instances

Instances details
Generic Style 
Instance details

Defined in Text.PrettyPrint.Annotated.HughesPJ

Associated Types

type Rep Style 
Instance details

Defined in Text.PrettyPrint.Annotated.HughesPJ

type Rep Style = D1 ('MetaData "Style" "Text.PrettyPrint.Annotated.HughesPJ" "pretty-1.1.3.6-inplace" '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))))

Methods

from :: Style -> Rep Style x

to :: Rep Style x -> Style

Show Style 
Instance details

Defined in Text.PrettyPrint.Annotated.HughesPJ

Methods

showsPrec :: Int -> Style -> ShowS

show :: Style -> String

showList :: [Style] -> ShowS

Eq Style 
Instance details

Defined in Text.PrettyPrint.Annotated.HughesPJ

Methods

(==) :: Style -> Style -> Bool

(/=) :: Style -> Style -> Bool

type Rep Style 
Instance details

Defined in Text.PrettyPrint.Annotated.HughesPJ

type Rep Style = D1 ('MetaData "Style" "Text.PrettyPrint.Annotated.HughesPJ" "pretty-1.1.3.6-inplace" '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))))

cat :: [Doc] -> Doc #

fcat :: [Doc] -> Doc #

first :: Doc -> Doc -> Doc #

fullRender :: Mode -> Int -> Float -> (TextDetails -> a -> a) -> a -> Doc -> a #

hang :: Doc -> Int -> Doc -> Doc #

hcat :: [Doc] -> Doc #

hsep :: [Doc] -> Doc #

isEmpty :: Doc -> Bool #

nest :: Int -> Doc -> Doc #

ptext :: String -> Doc #

reduceDoc :: Doc -> RDoc #

sep :: [Doc] -> Doc #

sizedText :: Int -> String -> Doc #

vcat :: [Doc] -> Doc #

braces :: Doc -> Doc #

maybeBraces :: Bool -> Doc -> Doc #

maybeBrackets :: Bool -> Doc -> Doc #

maybeDoubleQuotes :: Bool -> Doc -> Doc #

maybeParens :: Bool -> Doc -> Doc #

maybeQuotes :: Bool -> Doc -> Doc #

quotes :: Doc -> Doc #

rational :: Rational -> Doc #

renderStyle :: Style -> Doc -> String #

zeroWidthText :: String -> Doc #