Re: api to access .hi files

2019-08-02 Thread Artem Pelenitsyn
Hey Sam, Starting from the implementation of :browse and going through the call graph in: https://gitlab.haskell.org/ghc/ghc/blob/master/ghc/GHCi/UI.hs gave the following, which works for me: module Main where import Control.Monad import Control.Monad.IO.Class import

Re: api to access .hi files

2019-08-02 Thread Sam Halliday
Brandon Allbery writes: > No, those are in base. But I don't think you would be seeing imported names > as such there, come to think of it, only names declared locally. Hmm, then perhaps I misunderstand what it's doing. If I do what I thought might be the equivalent ghci command λ> :l

Re: api to access .hi files

2019-08-02 Thread Brandon Allbery
No, those are in base. But I don't think you would be seeing imported names as such there, come to think of it, only names declared locally. On Fri, Aug 2, 2019 at 4:06 PM Sam Halliday wrote: > Brandon Allbery writes: > > > At a guess, because the ghc package defaults to being hidden (it's >

Re: api to access .hi files

2019-08-02 Thread Sam Halliday
Brandon Allbery writes: > At a guess, because the ghc package defaults to being hidden (it's creating > a new ghc instance at runtime, so the visibility of the ghc package when > compiling your code is not relevant) you need to do the ghc-api equivalent > of "-package ghc". Or for testing just

Re: api to access .hi files

2019-08-02 Thread Brandon Allbery
At a guess, because the ghc package defaults to being hidden (it's creating a new ghc instance at runtime, so the visibility of the ghc package when compiling your code is not relevant) you need to do the ghc-api equivalent of "-package ghc". Or for testing just "ghc-pkg expose ghc". On Fri, Aug

Re: api to access .hi files

2019-08-02 Thread Sam Halliday
To answer my own question with a solution and another question: Sam Halliday writes: > I'm mostly interested in gathering information about symbols and their > type signatures. As a first exercise: given a module+import section > for a haskell source file, I want to find out which symbols (and

RE: Properly writing typechecker plugins

2019-08-02 Thread Simon Peyton Jones via ghc-devs
. I went looking in the GHC source, only to discover that you, Simon, are apparently deeply