Module Lib.PP

Courtesy of Philip Wadler.

This is a port of Prof. Philip Wadlers pretty printer library to Frege. For more info see "http://homepages.inf.ed.ac.uk/wadler/papers/prettier/prettier.pdf"

Imports

Table of Content

Definitions

data DOCUMENT

Constructors

APPEND DOCUMENT   DOCUMENT
GROUP DOCUMENT   DOCUMENT
infixr  9
LINE
NEST Int   DOCUMENT
NONE
TEXT (String)
data Doc

Constructors

Line {ind ∷ Int, doc ∷ Doc}
None
Text {hd ∷ String, doc ∷ Doc}

Member Functions

docDocDoc

access field doc

hdDocString

access field hd

indDocInt

access field ind

<>DOCUMENTDOCUMENTDOCUMENT
infixr  6
nestIntDOCUMENTDOCUMENT
textStringDOCUMENT
groupDOCUMENTDOCUMENT
flattenDOCUMENTDOCUMENT
layout'DocString
layoutDocST 𝖆 String
appendableFromWriterMutableIO WriterSTMutable RealWorld Appendable
native (Appendable)
prettyIOMutableIO WriterIntDOCUMENTIO ()
blanks64String
data PDOC

Constructors

PDOC {off ∷ Int, doc ∷ DOCUMENT}

Member Functions

docPDOCDOCUMENT

access field doc

offPDOCInt

access field off

bestIntIntDOCUMENTDoc
beIntInt[PDOC]Doc
betterIntIntDocMaybe Doc
fitsIntDocBool
prettyIntDOCUMENTString
<+>DOCUMENTDOCUMENTDOCUMENT
infixr  8

two documents with intervening space

</>DOCUMENTDOCUMENTDOCUMENT
infixr  7

two documents stacked

folddoc ∷ (DOCUMENTDOCUMENTDOCUMENT) → [DOCUMENT]DOCUMENT
spread[DOCUMENT]DOCUMENT

some documents with space inbetween

stack[DOCUMENT]DOCUMENT

some documents stacked

bracketStringDOCUMENTStringDOCUMENT
blockStringDOCUMENTStringDOCUMENT
<~/>DOCUMENTDOCUMENTDOCUMENT
infixr  7

join two documents without intervening space or stack them

<+/>DOCUMENTDOCUMENTDOCUMENT
infixr  7

join two documents with intervening space or stack them

fill[DOCUMENT]DOCUMENT
sepString[DOCUMENT]DOCUMENT

like fill, but with separator between items

tightString[DOCUMENT]DOCUMENT

like sep, but no space after separator

breakString → [DOCUMENT]

fill words of a string

msgdocStringDOCUMENT

turn a string into a document by breaking on space and filling up

Functions and Values by Type

(DOCUMENTDOCUMENTDOCUMENT) → [DOCUMENT] → DOCUMENT

folddoc

MutableIO WriterIntDOCUMENTIO ()

prettyIO

MutableIO WriterSTMutable RealWorld Appendable

appendableFromWriter

String → [DOCUMENT] → DOCUMENT

sep, tight

StringDOCUMENTStringDOCUMENT

block, bracket

StringDocDoc

Doc.Text

String → [DOCUMENT]

break

StringDOCUMENT

msgdoc, text, DOCUMENT.TEXT

[DOCUMENT] → DOCUMENT

fill, spread, stack

DOCUMENTDOCUMENTDOCUMENT

<+/>, <+>, </>, <>, <~/>, DOCUMENT.APPEND, DOCUMENT.GROUP

DOCUMENTDOCUMENT

flatten, group

Doc → (StringString) → Doc

Doc.chg$hd

Doc → (DocDoc) → Doc

Doc.chg$doc

Doc → (IntInt) → Doc

Doc.chg$ind

DocStringDoc

Doc.upd$hd

DocDocDoc

Doc.upd$doc

DocIntDoc

Doc.upd$ind

DocString

layout', Doc.hd

DocDoc

Doc.doc

DocBool

Doc.has$ind, Doc.has$doc, Doc.has$hd

DocInt

Doc.ind

PDOC → (DOCUMENTDOCUMENT) → PDOC

PDOC.chg$doc

PDOC → (IntInt) → PDOC

PDOC.chg$off

PDOCDOCUMENTPDOC

PDOC.upd$doc

PDOCIntPDOC

PDOC.upd$off

PDOCDOCUMENT

PDOC.doc

PDOCInt

PDOC.off

IntDOCUMENTString

pretty

IntDOCUMENTDOCUMENT

nest, DOCUMENT.NEST

IntDOCUMENTPDOC

PDOC.PDOC

IntDocDoc

Doc.Line

IntDocBool

fits

IntInt → [PDOC] → Doc

be

IntIntDOCUMENTDoc

best

IntIntDocMaybe Doc

better

String

blanks64

DOCUMENT

DOCUMENT.NONE, DOCUMENT.LINE

Doc

Doc.None

DocST 𝖆 String

layout

𝖆 → Bool

PDOC.has$doc, PDOC.has$off

Valid HTML 4.01 Strict