purescript-0.11.3: PureScript Programming Language Compiler

Safe HaskellNone
LanguageHaskell2010

Language.PureScript.Pretty.Common

Description

Common pretty-printing utility functions

Synopsis

Documentation

parens :: String -> String Source #

Wrap a string in parentheses

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

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

Generalize intercalate slightly for monoids

class Monoid gen => Emit gen where Source #

Minimal complete definition

emit, addMapping

Methods

emit :: Text -> gen Source #

addMapping :: SourceSpan -> gen Source #

newtype StrPos Source #

String with length and source-map entries

Constructors

StrPos (SourcePos, Text, [SMap]) 

Instances

Monoid StrPos Source #

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 Source # 

data PrinterState Source #

Constructors

PrinterState 

Fields

blockIndent :: Int Source #

Number of characters per identation level

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

Pretty print with a new indentation level

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

Get the current indentation level

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

Print many lines

before :: Box -> Box -> Box Source #

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

endWith :: Box -> Box -> Box Source #

Place a Box on the bottom right of another