Copyright | (c) 2013 - 2014 Björn Peemöller 2016 Finn Teegen |
---|---|
License | BSD-3-clause |
Maintainer | bjp@informatik.uni-kiel.de |
Stability | stable |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell2010 |
Curry.Base.Pretty
Description
This module re-exports the well known pretty printing combinators
from Hughes and Peyton-Jones. In addition, it re-exports the type class
Pretty
for pretty printing arbitrary types.
Synopsis
- class Pretty a where
- pPrint :: a -> Doc
- pPrintPrec :: Int -> a -> Doc
- pPrintList :: [a] -> Doc
- prettyShow :: Pretty a => a -> String
- parenIf :: Bool -> Doc -> Doc
- ppIf :: Bool -> Doc -> Doc
- maybePP :: (a -> Doc) -> Maybe a -> Doc
- blankLine :: Doc
- ($++$) :: Doc -> Doc -> Doc
- ($-$) :: Doc -> Doc -> Doc
- sepByBlankLine :: [Doc] -> Doc
- dot :: Doc
- appPrec :: Int
- larrow :: Doc
- rarrow :: Doc
- darrow :: Doc
- backQuote :: Doc
- backsl :: Doc
- vbar :: Doc
- bquotes :: Doc -> Doc
- bquotesIf :: Bool -> Doc -> Doc
- list :: [Doc] -> Doc
Documentation
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
Methods
Pretty-print something in isolation.
pPrintPrec :: Int -> a -> Doc Source #
Pretty-print something in a precedence context.
pPrintList :: [a] -> Doc Source #
Pretty-print a list.
Instances
Pretty Bool Source # | Instance for |
Defined in Curry.Base.Pretty Methods pPrint :: Bool -> Doc Source # pPrintPrec :: Int -> Bool -> Doc Source # pPrintList :: [Bool] -> Doc Source # | |
Pretty Char Source # | Instance for |
Defined in Curry.Base.Pretty Methods pPrint :: Char -> Doc Source # pPrintPrec :: Int -> Char -> Doc Source # pPrintList :: [Char] -> Doc Source # | |
Pretty Double Source # | Instance for |
Defined in Curry.Base.Pretty Methods pPrint :: Double -> Doc Source # pPrintPrec :: Int -> Double -> Doc Source # pPrintList :: [Double] -> Doc Source # | |
Pretty Float Source # | Instance for |
Defined in Curry.Base.Pretty Methods pPrint :: Float -> Doc Source # pPrintPrec :: Int -> Float -> Doc Source # pPrintList :: [Float] -> Doc Source # | |
Pretty Int Source # | Instance for |
Defined in Curry.Base.Pretty | |
Pretty Integer Source # | Instance for |
Defined in Curry.Base.Pretty Methods pPrint :: Integer -> Doc Source # pPrintPrec :: Int -> Integer -> Doc Source # pPrintList :: [Integer] -> Doc Source # | |
Pretty Ordering Source # | Instance for |
Defined in Curry.Base.Pretty Methods pPrint :: Ordering -> Doc Source # pPrintPrec :: Int -> Ordering -> Doc Source # pPrintList :: [Ordering] -> Doc Source # | |
Pretty () Source # | Instance for |
Defined in Curry.Base.Pretty | |
Pretty Position Source # | |
Defined in Curry.Base.Position | |
Pretty Message Source # | |
Defined in Curry.Base.Message | |
Pretty Span Source # | |
Defined in Curry.Base.Span | |
Pretty QualIdent Source # | |
Defined in Curry.Base.Ident | |
Pretty Ident Source # | |
Defined in Curry.Base.Ident | |
Pretty ModuleIdent Source # | |
Defined in Curry.Base.Ident Methods pPrint :: ModuleIdent -> Doc Source # pPrintPrec :: Int -> ModuleIdent -> Doc Source # pPrintList :: [ModuleIdent] -> Doc Source # | |
Pretty Op Source # | |
Defined in Curry.CondCompile.Type | |
Pretty Cond Source # | |
Defined in Curry.CondCompile.Type | |
Pretty Elif Source # | |
Defined in Curry.CondCompile.Type | |
Pretty Else Source # | |
Defined in Curry.CondCompile.Type | |
Pretty Stmt Source # | |
Defined in Curry.CondCompile.Type | |
Pretty Infix Source # | |
Defined in Curry.Syntax.Type | |
Pretty a => Pretty [a] Source # | Instance for '[]' |
Defined in Curry.Base.Pretty | |
Pretty a => Pretty (Maybe a) Source # | Instance for |
Defined in Curry.Base.Pretty Methods pPrint :: Maybe a -> Doc Source # pPrintPrec :: Int -> Maybe a -> Doc Source # pPrintList :: [Maybe a] -> Doc Source # | |
(Pretty a, Pretty b) => Pretty (Either a b) Source # | Instance for |
Defined in Curry.Base.Pretty Methods pPrint :: Either a b -> Doc Source # pPrintPrec :: Int -> Either a b -> Doc Source # pPrintList :: [Either a b] -> Doc Source # | |
(Pretty a, Pretty b) => Pretty (a, b) Source # | Instance for |
Defined in Curry.Base.Pretty Methods pPrint :: (a, b) -> Doc Source # pPrintPrec :: Int -> (a, b) -> Doc Source # pPrintList :: [(a, b)] -> Doc Source # | |
(Pretty a, Pretty b, Pretty c) => Pretty (a, b, c) Source # | Instance for |
Defined in Curry.Base.Pretty Methods pPrint :: (a, b, c) -> Doc Source # pPrintPrec :: Int -> (a, b, c) -> Doc Source # pPrintList :: [(a, b, c)] -> Doc Source # | |
(Pretty a, Pretty b, Pretty c, Pretty d) => Pretty (a, b, c, d) Source # | Instance for |
Defined in Curry.Base.Pretty Methods pPrint :: (a, b, c, d) -> Doc Source # pPrintPrec :: Int -> (a, b, c, d) -> Doc Source # pPrintList :: [(a, b, c, d)] -> Doc Source # | |
(Pretty a, Pretty b, Pretty c, Pretty d, Pretty e) => Pretty (a, b, c, d, e) Source # | Instance for |
Defined in Curry.Base.Pretty Methods pPrint :: (a, b, c, d, e) -> Doc Source # pPrintPrec :: Int -> (a, b, c, d, e) -> Doc Source # pPrintList :: [(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 for |
Defined in Curry.Base.Pretty Methods pPrint :: (a, b, c, d, e, f) -> Doc Source # pPrintPrec :: Int -> (a, b, c, d, e, f) -> Doc Source # pPrintList :: [(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 for |
Defined in Curry.Base.Pretty Methods pPrint :: (a, b, c, d, e, f, g) -> Doc Source # pPrintPrec :: Int -> (a, b, c, d, e, f, g) -> Doc Source # pPrintList :: [(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 for |
Defined in Curry.Base.Pretty Methods pPrint :: (a, b, c, d, e, f, g, h) -> Doc Source # pPrintPrec :: Int -> (a, b, c, d, e, f, g, h) -> Doc Source # pPrintList :: [(a, b, c, d, e, f, g, h)] -> Doc Source # |
prettyShow :: Pretty a => a -> String Source #
Pretty print a value to a String
.
maybePP :: (a -> Doc) -> Maybe a -> Doc Source #
Pretty print a Maybe
value for the Just
constructor only
($++$) :: Doc -> Doc -> Doc Source #
Above with a blank line in between. If one of the documents is empty, then the other document is returned.
($-$) :: Doc -> Doc -> Doc Source #
Above with overlapping, but with a space in between. If one of the documents is empty, then the other document is returned.
sepByBlankLine :: [Doc] -> Doc Source #
Seperate a list of Doc
s by a blankLine
.