purescript-0.11.5: PureScript Programming Language Compiler

Safe HaskellNone
LanguageHaskell2010

Language.PureScript.Pretty.Common

Description

Common pretty-printing utility functions

Synopsis

Documentation

parens :: String -> String #

Wrap a string in parentheses

parensPos :: Emit gen => gen -> gen #

intercalate :: Monoid m => m -> [m] -> m #

Generalize intercalate slightly for monoids

class Monoid gen => Emit gen where #

Minimal complete definition

emit, addMapping

Methods

emit :: Text -> gen #

addMapping :: SourceSpan -> gen #

data SMap #

newtype StrPos #

String with length and source-map entries

Constructors

StrPos (SourcePos, Text, [SMap]) 

Instances

Monoid StrPos #

Make a monoid where append consists of concatenating the string part, adding the lengths appropriately and advancing source mappings on the right hand side to account for the length of the left.

Emit StrPos # 

addMapping' :: Emit gen => Maybe SourceSpan -> gen #

data PrinterState #

Constructors

PrinterState 

Fields

blockIndent :: Int #

Number of characters per identation level

withIndent :: StateT PrinterState Maybe gen -> StateT PrinterState Maybe gen #

Pretty print with a new indentation level

currentIndent :: Emit gen => StateT PrinterState Maybe gen #

Get the current indentation level

prettyPrintMany :: Emit gen => (a -> StateT PrinterState Maybe gen) -> [a] -> StateT PrinterState Maybe gen #

Print many lines

before :: Box -> Box -> Box #

Place a box before another, vertically when the first box takes up multiple lines.

endWith :: Box -> Box -> Box #

Place a Box on the bottom right of another