Commit f2de618b authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Export the list of InstalledPackageInfo fields

To allow parsers & pretty-printers for extensions of the format.
parent 0a1b4810
......@@ -61,6 +61,7 @@ module Distribution.InstalledPackageInfo (
parseInstalledPackageInfo,
showInstalledPackageInfo,
showInstalledPackageInfoField,
fieldsInstalledPackageInfo,
) where
import Distribution.ParseUtils
......@@ -170,22 +171,23 @@ noVersion = Version{ versionBranch=[], versionTags=[] }
-- Parsing
parseInstalledPackageInfo :: String -> ParseResult InstalledPackageInfo
parseInstalledPackageInfo = parseFieldsFlat all_fields emptyInstalledPackageInfo
parseInstalledPackageInfo =
parseFieldsFlat fieldsInstalledPackageInfo emptyInstalledPackageInfo
-- -----------------------------------------------------------------------------
-- Pretty-printing
showInstalledPackageInfo :: InstalledPackageInfo -> String
showInstalledPackageInfo = showFields all_fields
showInstalledPackageInfo = showFields fieldsInstalledPackageInfo
showInstalledPackageInfoField :: String -> Maybe (InstalledPackageInfo -> String)
showInstalledPackageInfoField = showSingleNamedField all_fields
showInstalledPackageInfoField = showSingleNamedField fieldsInstalledPackageInfo
-- -----------------------------------------------------------------------------
-- Description of the fields, for parsing/printing
all_fields :: [FieldDescr InstalledPackageInfo]
all_fields = basicFieldDescrs ++ installedFieldDescrs
fieldsInstalledPackageInfo :: [FieldDescr InstalledPackageInfo]
fieldsInstalledPackageInfo = basicFieldDescrs ++ installedFieldDescrs
basicFieldDescrs :: [FieldDescr InstalledPackageInfo]
basicFieldDescrs =
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment