curry-base-1.1.1: Functions for manipulating Curry programs

Copyright(c) 2013 - 2014 Björn Peemöller
2016 Finn Teegen
LicenseBSD-3-clause
Maintainerbjp@informatik.uni-kiel.de
Stabilitystable
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

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

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

pPrintPrec | pPrint

Methods

pPrint :: a -> Doc Source #

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 Bool

Instance details

Defined in Curry.Base.Pretty

Pretty Char Source #

Instance for Char

Instance details

Defined in Curry.Base.Pretty

Pretty Double Source #

Instance for Double

Instance details

Defined in Curry.Base.Pretty

Pretty Float Source #

Instance for Float

Instance details

Defined in Curry.Base.Pretty

Pretty Int Source #

Instance for Int

Instance details

Defined in Curry.Base.Pretty

Pretty Integer Source #

Instance for Integer

Instance details

Defined in Curry.Base.Pretty

Pretty Ordering Source #

Instance for Ordering

Instance details

Defined in Curry.Base.Pretty

Pretty () Source #

Instance for '()'

Instance details

Defined in Curry.Base.Pretty

Methods

pPrint :: () -> Doc Source #

pPrintPrec :: Int -> () -> Doc Source #

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

Pretty Position Source # 
Instance details

Defined in Curry.Base.Position

Pretty Message Source # 
Instance details

Defined in Curry.Base.Message

Pretty Span Source # 
Instance details

Defined in Curry.Base.Span

Pretty QualIdent Source # 
Instance details

Defined in Curry.Base.Ident

Pretty Ident Source # 
Instance details

Defined in Curry.Base.Ident

Pretty ModuleIdent Source # 
Instance details

Defined in Curry.Base.Ident

Pretty Op Source # 
Instance details

Defined in Curry.CondCompile.Type

Pretty Cond Source # 
Instance details

Defined in Curry.CondCompile.Type

Pretty Elif Source # 
Instance details

Defined in Curry.CondCompile.Type

Pretty Else Source # 
Instance details

Defined in Curry.CondCompile.Type

Pretty Stmt Source # 
Instance details

Defined in Curry.CondCompile.Type

Pretty Infix Source # 
Instance details

Defined in Curry.Syntax.Type

Pretty a => Pretty [a] Source #

Instance for '[]'

Instance details

Defined in Curry.Base.Pretty

Methods

pPrint :: [a] -> Doc Source #

pPrintPrec :: Int -> [a] -> Doc Source #

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

Pretty a => Pretty (Maybe a) Source #

Instance for Maybe

Instance details

Defined in Curry.Base.Pretty

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

Instance for Either

Instance details

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 '(,)'

Instance details

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 '(,,)'

Instance details

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 '(,,,)'

Instance details

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 '(,,,,)'

Instance details

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 '(,,,,,)'

Instance details

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 '(,,,,,,)'

Instance details

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 '(,,,,,,,)'

Instance details

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.

parenIf :: Bool -> Doc -> Doc Source #

Parenthesize an value if the boolean is true.

ppIf :: Bool -> Doc -> Doc Source #

Pretty print a value if the boolean is true

maybePP :: (a -> Doc) -> Maybe a -> Doc Source #

Pretty print a Maybe value for the Just constructor only

blankLine :: Doc Source #

A blank line.

($++$) :: 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 Docs by a blankLine.

dot :: Doc Source #

A . character.

appPrec :: Int Source #

Precedence of function application

larrow :: Doc Source #

A left arrow <-.

rarrow :: Doc Source #

A right arrow ->.

darrow :: Doc Source #

A double arrow =>.

backQuote :: Doc Source #

A back quote `.

backsl :: Doc Source #

A backslash @@.

vbar :: Doc Source #

A vertical bar |.

bquotes :: Doc -> Doc Source #

Set a document in backquotes.

bquotesIf :: Bool -> Doc -> Doc Source #

Set a document in backquotes if the condition is True.

list :: [Doc] -> Doc Source #

Seperate a list of documents by commas