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 ( ...@@ -61,6 +61,7 @@ module Distribution.InstalledPackageInfo (
parseInstalledPackageInfo, parseInstalledPackageInfo,
showInstalledPackageInfo, showInstalledPackageInfo,
showInstalledPackageInfoField, showInstalledPackageInfoField,
fieldsInstalledPackageInfo,
) where ) where
import Distribution.ParseUtils import Distribution.ParseUtils
...@@ -170,22 +171,23 @@ noVersion = Version{ versionBranch=[], versionTags=[] } ...@@ -170,22 +171,23 @@ noVersion = Version{ versionBranch=[], versionTags=[] }
-- Parsing -- Parsing
parseInstalledPackageInfo :: String -> ParseResult InstalledPackageInfo parseInstalledPackageInfo :: String -> ParseResult InstalledPackageInfo
parseInstalledPackageInfo = parseFieldsFlat all_fields emptyInstalledPackageInfo parseInstalledPackageInfo =
parseFieldsFlat fieldsInstalledPackageInfo emptyInstalledPackageInfo
-- ----------------------------------------------------------------------------- -- -----------------------------------------------------------------------------
-- Pretty-printing -- Pretty-printing
showInstalledPackageInfo :: InstalledPackageInfo -> String showInstalledPackageInfo :: InstalledPackageInfo -> String
showInstalledPackageInfo = showFields all_fields showInstalledPackageInfo = showFields fieldsInstalledPackageInfo
showInstalledPackageInfoField :: String -> Maybe (InstalledPackageInfo -> String) showInstalledPackageInfoField :: String -> Maybe (InstalledPackageInfo -> String)
showInstalledPackageInfoField = showSingleNamedField all_fields showInstalledPackageInfoField = showSingleNamedField fieldsInstalledPackageInfo
-- ----------------------------------------------------------------------------- -- -----------------------------------------------------------------------------
-- Description of the fields, for parsing/printing -- Description of the fields, for parsing/printing
all_fields :: [FieldDescr InstalledPackageInfo] fieldsInstalledPackageInfo :: [FieldDescr InstalledPackageInfo]
all_fields = basicFieldDescrs ++ installedFieldDescrs fieldsInstalledPackageInfo = basicFieldDescrs ++ installedFieldDescrs
basicFieldDescrs :: [FieldDescr InstalledPackageInfo] basicFieldDescrs :: [FieldDescr InstalledPackageInfo]
basicFieldDescrs = 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