Skip to content
This repository has been archived by the owner on Dec 25, 2023. It is now read-only.
/ unfoldings Public archive

A simple experiment to see if we can fetch definitions (unfoldings) of the transitive closure of a module from a GHC Plugin.

Notifications You must be signed in to change notification settings

ckoparkar/unfoldings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fetch all unfoldings

A simple experiment to see if we can fetch definitions (unfoldings) of the transitive closure of a module from within a GHC Plugin:

  • plugin: the plugin, prints all definitions it has access to.
  • examples: a package that uses this plugin.
  • test-lib: a library used by "examples".

This stanza in the cabal.project file is the key bit:

package *
    ghc-options: -fexpose-all-unfoldings

It re-compiles all the dependencies with the flag -fexpose-all-unfoldings which allows us to fetch the definitions. This doesn't work for GHC's core libraries; Cabal always uses their precompiled versions. To try this, you can run cabal v2-build all > all_unfoldings.txt. This compiles examples with the GHC plugin and writes its output to all_unfoldings.txt in which you should see all definitions from the libraries unordered-containers (a direct dependency of examples) and hashable (a transitive dependency of examples).

About

A simple experiment to see if we can fetch definitions (unfoldings) of the transitive closure of a module from a GHC Plugin.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published