-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #149 from phadej/subextralibs
Allow sublibraries in extra-package option
- Loading branch information
Showing
5 changed files
with
76 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
module CabalDocspec.Library where | ||
|
||
import Peura | ||
|
||
import qualified Distribution.Compat.CharParsing as P | ||
import qualified Distribution.Parsec as C | ||
import qualified Distribution.Pretty as C | ||
import qualified Distribution.Types.PackageName as C | ||
import qualified Distribution.Types.UnqualComponentName as C | ||
import qualified Text.PrettyPrint as PP | ||
|
||
data Library = Library !PackageName !LibraryName | ||
deriving (Eq, Ord, Show) | ||
|
||
instance C.Parsec Library where | ||
parsec = do | ||
pn <- C.parsec | ||
ln <- fmap (fromMaybe LMainLibName) $ optional $ do | ||
_ <- P.char ':' | ||
qn <- C.parsec | ||
return $ | ||
if C.unPackageName pn == C.unUnqualComponentName qn | ||
then LMainLibName | ||
else LSubLibName qn | ||
|
||
return (Library pn ln) | ||
|
||
instance C.Pretty Library where | ||
pretty (Library pn LMainLibName) = C.pretty pn | ||
pretty (Library pn (LSubLibName ln)) = C.pretty pn <> PP.colon <> C.pretty ln |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters