Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
Packages
Cabal
Commits
cbc1a1de
Commit
cbc1a1de
authored
Oct 02, 2016
by
Edward Z. Yang
Browse files
Add a parser for 'key' field of InstalledPackageInfo
Rather than reusing the one for ComponentId.
parent
7637d067
Changes
1
Hide whitespace changes
Inline
Side-by-side
Cabal/Distribution/InstalledPackageInfo.hs
View file @
cbc1a1de
...
...
@@ -55,6 +55,7 @@ import qualified Distribution.Compat.ReadP as Parse
import
Distribution.Compat.Graph
import
Text.PrettyPrint
as
Disp
import
qualified
Data.Char
as
Char
-- -----------------------------------------------------------------------------
-- The InstalledPackageInfo type
...
...
@@ -233,6 +234,13 @@ showInstalledPackageInfoField = showSingleNamedField fieldsInstalledPackageInfo
showSimpleInstalledPackageInfoField
::
String
->
Maybe
(
InstalledPackageInfo
->
String
)
showSimpleInstalledPackageInfoField
=
showSimpleSingleNamedField
fieldsInstalledPackageInfo
dispCompatPackageKey
::
String
->
Doc
dispCompatPackageKey
=
text
parseCompatPackageKey
::
Parse
.
ReadP
r
String
parseCompatPackageKey
=
Parse
.
munch1
uid_char
where
uid_char
c
=
Char
.
isAlphaNum
c
||
c
`
elem
`
"-_.=[],:<>+"
-- -----------------------------------------------------------------------------
-- Description of the fields, for parsing/printing
...
...
@@ -250,9 +258,8 @@ basicFieldDescrs =
,
simpleField
"id"
disp
parse
installedUnitId
(
\
pk
pkg
->
pkg
{
installedUnitId
=
pk
})
-- NB: parse these as component IDs
,
simpleField
"key"
(
disp
.
mkComponentId
)
(
fmap
unComponentId
parse
)
disp
CompatPackageKey
parseCompatPackageKey
compatPackageKey
(
\
pk
pkg
->
pkg
{
compatPackageKey
=
pk
})
,
simpleField
"license"
disp
parseLicenseQ
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment