Safe Haskell | None |
---|---|
Language | Haskell98 |
Common pretty-printing utility functions
- parens :: String -> String
- parensPos :: Emit gen => gen -> gen
- intercalate :: Monoid m => m -> [m] -> m
- class Monoid gen => Emit gen where
- emit :: String -> gen
- addMapping :: SourceSpan -> gen
- data SMap = SMap String SourcePos SourcePos
- newtype StrPos = StrPos (SourcePos, String, [SMap])
- newtype PlainString = PlainString String
- runPlainString :: PlainString -> String
- addMapping' :: Emit gen => Maybe SourceSpan -> gen
- bumpPos :: SourcePos -> SMap -> SMap
- addPos :: SourcePos -> SourcePos -> SourcePos
- data PrinterState = PrinterState {}
- emptyPrinterState :: PrinterState
- blockIndent :: Int
- withIndent :: Emit gen => StateT PrinterState Maybe gen -> StateT PrinterState Maybe gen
- currentIndent :: Emit gen => StateT PrinterState Maybe gen
- prettyPrintMany :: Emit gen => (a -> StateT PrinterState Maybe gen) -> [a] -> StateT PrinterState Maybe gen
- prettyPrintObjectKey :: String -> String
- before :: Box -> Box -> Box
- beforeWithSpace :: Box -> Box -> Box
Documentation
intercalate :: Monoid m => m -> [m] -> m Source
Generalize intercalate slightly for monoids
class Monoid gen => Emit gen where Source
addMapping :: SourceSpan -> gen Source
String with length and source-map entries
addMapping' :: Emit gen => Maybe SourceSpan -> gen Source
data PrinterState Source
blockIndent :: Int Source
Number of characters per identation level
withIndent :: Emit gen => 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
prettyPrintObjectKey :: String -> String Source
Prints an object key, escaping reserved names.
before :: Box -> Box -> Box Source
Place a box before another, vertically when the first box takes up multiple lines.
beforeWithSpace :: Box -> Box -> Box Source