purescript-0.15.15: PureScript Programming Language Compiler
Safe HaskellNone
LanguageHaskell2010

Language.PureScript.Pretty.Common

Description

Common pretty-printing utility functions

Synopsis

Documentation

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

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

Generalize intercalate slightly for monoids

class Monoid gen => Emit gen where #

Methods

emit :: Text -> gen #

addMapping :: SourceSpan -> gen #

Instances

Instances details
Emit PlainString # 
Instance details

Defined in Language.PureScript.Pretty.Common

Emit StrPos # 
Instance details

Defined in Language.PureScript.Pretty.Common

data SMap #

newtype StrPos #

String with length and source-map entries

Constructors

StrPos (SourcePos, Text, [SMap]) 

Instances

Instances details
Monoid StrPos # 
Instance details

Defined in Language.PureScript.Pretty.Common

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

Instance details

Defined in Language.PureScript.Pretty.Common

Emit StrPos # 
Instance details

Defined in Language.PureScript.Pretty.Common

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

data PrinterState #

Constructors

PrinterState 

Fields

blockIndent :: Int #

Number of characters per indentation 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

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