debian-3.79.1: Modules for working with the Debian package system

Safe HaskellNone





newtype Control' a Source




unControl :: [Paragraph' a]


Pretty (Control' String)

This may have bad performance issues (why?)

Pretty (Control' Text)

parseFromFile p filePath runs a string parser p on the input read from filePath using readFile. Returns either a ParseError (Left) or a value of type a (Right).

  main    = do{ result <- parseFromFile numbers "digits.txt"
              ; case result of
                  Left err  -> print err
                  Right xs  -> print (sum xs)

This may have bad performance issues (why?)

newtype Paragraph' a Source


Paragraph [Field' a] 

data Field' a Source

NOTE: we do not strip the leading or trailing whitespace in the name or value


Field (a, a) 
Comment a

Lines beginning with #


class ControlFunctions a whereSource


parseControlFromFile :: FilePath -> IO (Either ParseError (Control' a))Source

parseControlFromFile filepath is a simple wrapper function that parses filepath using pControl

parseControlFromHandle :: String -> Handle -> IO (Either ParseError (Control' a))Source

parseControlFromHandle sourceName handle - sourceName is only used for error reporting

parseControl :: String -> a -> Either ParseError (Control' a)Source

parseControlFromString sourceName text - sourceName is only used for error reporting

lookupP :: String -> Paragraph' a -> Maybe (Field' a)Source

lookupP fieldName paragraph looks up a Field in a Paragraph. N.B. trailing and leading whitespace is not stripped.

stripWS :: a -> aSource

Strip the trailing and leading space and tab characters from a string. Folded whitespace is not unfolded. This should probably be moved to someplace more general purpose.

asString :: a -> StringSource

Helper Functions

renameField :: Eq a => a -> a -> Paragraph' a -> Paragraph' aSource

modifyField :: Eq a => a -> (a -> a) -> Paragraph' a -> Paragraph' aSource

raiseFields :: Eq a => (a -> Bool) -> Paragraph' a -> Paragraph' aSource

Move selected fields to the beginning of a paragraph.