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
a493bca1
Commit
a493bca1
authored
Jul 10, 2016
by
Edward Z. Yang
Browse files
Display class for ComponentName.
Signed-off-by:
Edward Z. Yang
<
ezyang@cs.stanford.edu
>
parent
309a012c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Cabal/Distribution/PackageDescription.hs
View file @
a493bca1
...
...
@@ -975,6 +975,23 @@ data ComponentName = CLibName String
instance
Binary
ComponentName
-- Build-target-ish syntax
instance
Text
ComponentName
where
disp
(
CLibName
str
)
=
Disp
.
text
(
"lib:"
++
str
)
disp
(
CExeName
str
)
=
Disp
.
text
(
"exe:"
++
str
)
disp
(
CTestName
str
)
=
Disp
.
text
(
"test:"
++
str
)
disp
(
CBenchName
str
)
=
Disp
.
text
(
"bench:"
++
str
)
parse
=
do
ctor
<-
Parse
.
choice
[
Parse
.
string
"lib:"
>>
return
CLibName
,
Parse
.
string
"exe:"
>>
return
CExeName
,
Parse
.
string
"bench:"
>>
return
CBenchName
,
Parse
.
string
"test:"
>>
return
CTestName
]
-- For now, component names coincide with package name syntax
-- (since they can show up in build-depends, which are parsed
-- as package names.)
fmap
(
ctor
.
unPackageName
)
parse
defaultLibName
::
PackageIdentifier
->
ComponentName
defaultLibName
pid
=
CLibName
(
display
(
pkgName
pid
))
...
...
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