[GHC] #3464: Find import declaration importing a certain
function
GHC
cvs-ghc at haskell.org
Sat Oct 2 11:34:19 EDT 2010
#3464: Find import declaration importing a certain function
---------------------------------+------------------------------------------
Reporter: fasta | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: 7.0.1
Component: GHCi | Version: 6.10.4
Keywords: | Testcase:
Blockedby: | Difficulty: Unknown
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: None/Unknown
---------------------------------+------------------------------------------
Changes (by claus):
* failure: => None/Unknown
Comment:
Until you find someone to implement this feature properly, there is a
workaround.
Using the GHCi script `redir.script`, attached to #4332, you can capture
the output of `:browse!`.
`:browse!` extends `:browse` by including information about import paths
in comments, so we can filter for lines with comments or the identifier in
question to get the info you're after:
{{{
*ModMain> :redir output :browse! *ModMain
*ModMain> putStrLn $ unlines $ filter ((`elem`["--","map"]).head.words) $
lines output
-- imported via ModC, ModB, Prelude
map :: (a -> b) -> [a] -> [b]
-- imported via Prelude
}}}
Once we have the right incantation, we can define another GHCi command for
this (normally, I'd use regexes, but they are broken in GHC head right
now).
Hope this helps
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3464#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list