Core of a whole package
Ömer Sinan Ağacan
omeragacan at gmail.com
Wed Jun 1 08:38:40 UTC 2016
> So how do I dump the contents of a module to a .hi file? Is this
> something I can do through the API?
I'm not saying you can at the moment, I'm just saying usually if you need some
cross-module sharing you put the stuff you want to read when compiling other
files in .hi files as those files are read when compiling other modules.
In you case I think you can just keep a file, write your module-level stats
there and then run a post-compilation pass to generate final stats.
2016-06-01 3:35 GMT-04:00 Alberto Sadde O. <albertosadde at gmail.com>:
> I am trying to extract information at the Core level about which functions
> are the most used within a package, which data types are the most used.
> So how do I dump the contents of a module to a .hi file? Is this something I
> can do through the API?
> On Wed, Jun 1, 2016 at 8:31 AM, Ömer Sinan Ağacan <omeragacan at gmail.com>
>> You have to do your manipulations module by module, as GHC is doing
>> that way. If you need some information from other modules when compiling a
>> module, you should dump that information in .hi files (like definitions of
>> inline functions).
>> What exactly are you trying to do?
>> 2016-05-31 17:56 GMT-04:00 Alberto Sadde O. <albertosadde at gmail.com>:
>> >> 2016-05-31 16:04 GMT-04:00 Alberto Sadde O. <albertosadde at gmail.com>:
>> >> > I am trying to get the Core of a whole package.
>> >> > I have been using the GHC API to get the Core of each file in a
>> >> > package
>> >> > but
>> >> > I have a problems with non-exposed modules of the package.
>> >> Try `cabal install --ghc-options="-ddump-simpl -ddump-to-file"`. You
>> >> should see Core outputs under `dist/`.
>> >> (or `cabal configure --ghc-options=...` then `cabal build`)
>> >> If you have all the dependencies installed already you can just do
>> >> `ghc --make Main.hs -fforce-recomp -ddump-simpl -ddump-to-file` where
>> >> `Main.hs` imports all the modules in your project.
>> > Thanks for the answer.
>> > The thing is that I want to manipulate the Core of the package not just
>> > simply dump it to a file.
More information about the ghc-devs