language-qux-0.1.1.3: Utilities for working with the Qux language

Copyright(c) Henry J. Wylde, 2015
LicenseBSD3
Maintainerpublic@hjwylde.com
Safe HaskellSafe
LanguageHaskell2010

Language.Qux.Annotated.PrettyPrinter

Contents

Description

Text.PrettyPrint instances and rendering functions for Qux language elements.

To render a program, call: render $ pPrint program

Synopsis

Documentation

class Pretty a where

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

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

pPrint :: a -> Doc

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

Instances

Pretty Bool 
Pretty Char 
Pretty Double 
Pretty Float 
Pretty Int 
Pretty Integer 
Pretty Ordering 
Pretty () 
Pretty a => Pretty [a] 
Pretty a => Pretty (Maybe a) 
(Pretty a, Pretty b) => Pretty (Either a b) 
(Pretty a, Pretty b) => Pretty (a, b) 
(Pretty a, Pretty b, Pretty c) => Pretty (a, b, c) 
(Pretty a, Pretty b, Pretty c, Pretty d) => Pretty (a, b, c, d) 
(Pretty a, Pretty b, Pretty c, Pretty d, Pretty e) => Pretty (a, b, c, d, e) 
(Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f) => Pretty (a, b, c, d, e, f) 
(Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f, Pretty g) => Pretty (a, b, c, d, e, f, g) 
(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) 

data Style :: *

A rendering style.

Constructors

Style 

Fields

mode :: Mode

The rendering mode

lineLength :: Int

Length of line, in chars

ribbonsPerLine :: Float

Ratio of line length to ribbon length

Instances

Eq Style 
Show Style 
Generic Style 
type Rep Style = D1 D1Style (C1 C1_0Style ((:*:) (S1 S1_0_0Style (Rec0 Mode)) ((:*:) (S1 S1_0_1Style (Rec0 Int)) (S1 S1_0_2Style (Rec0 Float))))) 

data Mode :: *

Rendering mode.

Constructors

PageMode

Normal

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 = D1 D1Mode ((:+:) ((:+:) (C1 C1_0Mode U1) (C1 C1_1Mode U1)) ((:+:) (C1 C1_2Mode U1) (C1 C1_3Mode U1))) 

Rendering

render :: Doc -> String

Render the Doc to a String using the default Style.

renderStyle :: Style -> Doc -> String

Render the Doc to a String using the given Style.

renderOneLine :: Doc -> String Source

Like render, but renders the doc on one line.