> $ghc-pkg --where-from ParseError
> package parsec: defining modules: Text.ParserCombinators.Parsec.Error,
> Text.ParserCombinators.Parsec
>
> ?
This is what I've done by now... It took me some days to notice that the
./ghc-pkg symlinks to ghc-pkg-6.5xxxx which calls the ghc-pkg from /usr/lib/...
but not my modified version ;) ./ghc-pkg.bin was what I was looking for..
By now you can only search for modules...
I want to add support for functions..
I could use ghc -show-iface.. Problem: ghc takes about 0.2 s to launch on my
system. Dumping all installed ifaces (ghc -show-iface <list of all hi files>)
doesn't take much additional time..
That's why I want to include the MkIface module from ghc.. (beeing in another
directory)
I'm not sure where to add the -i option in the makefile so that ghc can find
the module..
One way would be adding the option to EXTRA_SRCS but I hope there is a better
possibility
Marc
< {-# OPTIONS -fglasgow-exts #-}
---
> whereFrom OPTIONS -fglasgow-exts #-}
18,20d17
< #ifdef WHERE_FROM
< import MkIface
< #endif
185,189d181
< #ifdef WHERE_FROM
< " $p where-from {id}\n" ++
< " Which package/module contains this module/ declaration?\n" ++
< "\n" ++
< #endif
237,240d228
< #ifdef WHERE_FROM
< ["where-from", id] -> do
< whereFrom cli id
< #endif
469,500d456
< #ifdef WHERE_FROM
< --
-----------------------------------------------------------------------------
< -- Where from find the modul or package containing the id
<
< whereFrom :: [Flag] -> String -> IO ()
< whereFrom flags id =
< let simple_output = FlagSimpleOutput `elem` flags
< in do db_stack <- getPkgDatabases False flags
< let all_pkgs = concat (map snd db_stack) :: [InstalledPackageInfo]
< -- looking for modules with name id
< let exposedModulesMatches = ("exposed matching modules",
< concatMap (getPkgNameAndModule exposedModules) all_pkgs ) ::
(String, [String])
< let hiddenModulesMatches = ("hidden matching modules",
< concatMap (getPkgNameAndModule hiddenModules) all_pkgs )
< -- looking for data
< -- looking for type
< -- looking for newtype
< -- looking for functions
< let matchingResult = filter ((/= []).snd) [exposedModulesMatches,
hiddenModulesMatches]
< case matchingResult of
< [] -> putStrLn "no matches found"
< results -> do putStrLn "maches :"
< mapM_ (\(category, matches) -> putStrLn (category ++
":") >> mapM_ putStrLn matches) results
<
< where getPkgNameAndModule modules pkginfo = [ formatFoundModule
((showPackageId.package) pkginfo) m | m <- modules pkginfo, (m == id) ]
< formatFoundModule pkg module_ = pkg ++ ": " ++ module_
< scanPackage pkg scanModule = lifM2 (++) (concatMap (scanModule "")
(exposedModules pkg))
< (concatMap (scanModule
"hidden") (hiddenModules pkg))
< where scanModule hidden_text module_ =
<
< #endif
_______________________________________________
Glasgow-haskell-users mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users