#1463: Module → Package lookup in ghc-pkg?
----------------------------------+-----------------------------------------
Reporter: [EMAIL PROTECTED] | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: 6.10
Component: Compiler | Version: 6.6.1
Severity: normal | Resolution:
Keywords: | Difficulty: Unknown
Os: Unknown | Testcase:
Architecture: Unknown |
----------------------------------+-----------------------------------------
Comment (by claus):
To get an InstalledPackageInfo for a given package, you have to use ghc-
pkg describe and parse the output (I believe it should work). Parsing
package.conf directly is non-portable, and risks breakage in the future.
hmm. i was looking for a portable, cabal-based way to get the info. i
wouldn't mind if cabal offered me a way to get that without telling me
what the actual representation is, but InstalledPackageInfo seems to be
the only concrete format defined so far, so converting whatever the actual
format is into that would seem to make sense.
if there is no cabal way (ghc-pkg certainly isn't), the next best thing
would be to use the ghc api, provided that the ghc-pkg functionality is
exposed there? alternatively, ghc-pkg itself could be extended, but i
assume that different tools prefer the info in different formats, so i'd
prefer a programmable solution, without reparsing unstable output formats.
btw, 'ghc --simple-output field exposed-modules' should probably drop the
field label?
just to explain the dilemma: currently, my haskell mode for vim uses
vimscript to extract part of the info from haddock's index files, and
another part of the info from calling 'ghc -e :browse' on all imported
modules. it then builds dictionaries for fast access to that info, and in
the case of standard libs, caches that dictionary in a file for speed.
now, haddock is the only tool that knows which identifiers in the
installed libs have haddock comments, and what their relative urls are,
but i can't help feeling that there must be an easier way to get all that
info (i'm not even trying to extract types from haddock index files). i
assume David has something similar in mind for emacs?
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1463>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs