jinquantities-0.1.1: Unit conversion and manipulation library.

Safe HaskellSafe



Uses parsec to parse definition lines.



parseDefinitions :: String -> [Definition] Source #

Parse multiline string of definitions (say, from a file) into a list of definitions.

parseDefinitions' :: Parser [Definition] Source #

Parsec parser for definitions.

parseDef :: Parser Definition Source #

Parse any definition line

eol :: Parser Char Source #

Custom eol parsec parser.

parseDefLine :: Parser Definition Source #

Parse a line containing unit definition Ex: minute = 60 s = min

parseUnitDef :: Parser Definition Source #

Parses a unit definition. Example: foot = 12 in = ft = feet

parseSynonym :: Parser Symbol Source #

Parses the synonyms at the end of a base or unit definition.

parseBaseLine :: Parser Definition Source #

Parse line containing base definition. Ex: meter = [length] = m

parseBase :: Parser (Symbol, Symbol) Source #

Parse the base of a base definition. Example: [length] -> length

parsePrefixLine :: Parser Definition Source #

Parse line containing prefix definition Ex: milli- = 1e-3 = m-

parsePrefix :: Parser (Symbol, Double) Source #

Parse the prefix part of a prefix definition. Example: yocto- -> yocto

parsePrefixSynonym :: Parser Symbol Source #

Parse the synonyms for a prefix definition.

parseSymbol :: Parser Symbol Source #

Parse a symbol for a unit