ltk-0.12.1.0: Leksah tool kit

Safe Haskell | None

Text.PrinterParser

Description

Module for saving and restoring preferences and settings

Synopsis

- type Printer beta = beta -> Doc
- type Parser beta = CharParser () beta
- data FieldDescriptionS alpha = FDS {
  - parameters :: Parameters
  - fieldPrinter :: alpha -> Doc
  - fieldParser :: alpha -> CharParser () alpha
  }
- type MkFieldDescriptionS alpha beta = Parameters -> Printer beta -> Parser beta -> Getter alpha beta -> Setter alpha beta -> FieldDescriptionS alpha
- mkFieldS :: MkFieldDescriptionS alpha beta
- applyFieldParsers :: a -> [a -> CharParser () a] -> CharParser () a
- boolParser :: CharParser () Bool
- intParser :: CharParser () Int
- lineParser :: CharParser () String
- pairParser :: CharParser () alpha -> CharParser () (alpha, alpha)
- identifier :: CharParser st String
- emptyParser :: CharParser () ()
- whiteSpace :: CharParser st ()
- stringParser :: CharParser () String
- readParser :: Read a => CharParser () a
- colorParser :: CharParser () Color
- emptyPrinter :: () -> Doc
- class Pretty a where
  - pretty :: a -> Doc
  - prettyPrec :: Int -> a -> Doc
- prettyPrint :: Pretty a => a -> String
- maybePP :: (a -> Doc) -> Maybe a -> Doc
- symbol :: String -> CharParser st String
- colon :: CharParser st String
- writeFields :: FilePath -> alpha -> [FieldDescriptionS alpha] -> IO ()
- showFields :: alpha -> [FieldDescriptionS alpha] -> String
- readFields :: FilePath -> [FieldDescriptionS alpha] -> alpha -> IO alpha
- parseFields :: alpha -> [FieldDescriptionS alpha] -> CharParser () alpha

# Documentation

type Printer beta = beta -> Doc Source

type Parser beta = CharParser () betaSource

data FieldDescriptionS alpha Source

Constructors

FDS |

Fields

parameters :: Parameters
fieldPrinter :: alpha -> Doc
fieldParser :: alpha -> CharParser () alpha

type MkFieldDescriptionS alpha beta = Parameters -> Printer beta -> Parser beta -> Getter alpha beta -> Setter alpha beta -> FieldDescriptionS alphaSource

mkFieldS :: MkFieldDescriptionS alpha betaSource

applyFieldParsers :: a -> [a -> CharParser () a] -> CharParser () aSource

boolParser :: CharParser () Bool Source

intParser :: CharParser () Int Source

lineParser :: CharParser () String Source

pairParser :: CharParser () alpha -> CharParser () (alpha, alpha)Source

identifier :: CharParser st String Source

emptyParser :: CharParser () ()Source

whiteSpace :: CharParser st ()Source

stringParser :: CharParser () String Source

readParser :: Read a => CharParser () aSource

colorParser :: CharParser () Color Source

emptyPrinter :: () -> Doc Source

class Pretty a where Source

Things that can be pretty-printed

Methods

pretty :: a -> Doc Source

Pretty-print something in isolation.

prettyPrec :: Int -> a -> Doc Source

Pretty-print something in a precedence context.

Instances

Pretty String |

prettyPrint :: Pretty a => a -> String Source

pretty-print with the default style and `defaultMode`.

maybePP :: (a -> Doc) -> Maybe a -> Doc Source

symbol :: String -> CharParser st String Source

colon :: CharParser st String Source

writeFields :: FilePath -> alpha -> [FieldDescriptionS alpha] -> IO ()Source

showFields :: alpha -> [FieldDescriptionS alpha] -> String Source

readFields :: FilePath -> [FieldDescriptionS alpha] -> alpha -> IO alphaSource

parseFields :: alpha -> [FieldDescriptionS alpha] -> CharParser () alphaSource