purescript-0.13.0: 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 #

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
Semigroup 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.

Instance details

Defined in Language.PureScript.Pretty.Common

Monoid StrPos Source # 
Instance details

Defined in Language.PureScript.Pretty.Common

Emit StrPos Source # 
Instance details

Defined in Language.PureScript.Pretty.Common

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