Skip to content

For a Cabal package, combine a call graph traversal and cost center stacks from GHC executing its dependents to understand how packages are used in the wild

License

BSD-3-Clause, BSD-3-Clause licenses found

Licenses found

BSD-3-Clause
LICENSE
BSD-3-Clause
LICENSE_hiedb
Notifications You must be signed in to change notification settings

acrylic-origami/stacker

Stacker 🥞

Stacker is a mixed static/runtime analyzer that runs the dependents of a Cabal package of interest to find out how it's used in the wild. Stacker creates a dependency graph of values starting from a function call from a package dependent.

Try it live at http://stacker.lam.io!

Stacker's main goal is to address barriers to adoption of packages and frameworks that arises from skepticism about examples and The Right Way. Instead, let's prefer collecting hard statistics on how people actually use the API. Reciprocally, it also helps package owners identify kludges in their interface.

Stacker uses GHC's cost-centre profiler to collect a stack trace from executing tests on a package dependent. It then analyzes HIE (Haskell Interface Extended) files that contain the ASTs of the sources in the compilation set. In the AST, Stacker follows dependencies of the target package's functions up the call stack and along value bindings to backtrack the arguments to the function of interest as well.

Note: HIE files are a new feature of GHC 8.8.

Try running stacker on itself!

  1. ./run to build the project in target which will be analyzed on the first cycle.
  2. Open target/stacker-fake-pkg.prof and find the cost centre ID for main.
  3. Grab the "Cost centre no." (the fourth column, just after the source location).
  4. Build and run stacker against the target with ./run <main-cost-centre-num> target/stacker-fake-pkg.prof target/hie.
  5. Run stacker against itself subsequently by:
    1. Opening ./stacker.prof and finding the cost center # of a function call of interest;
    2. Stashing the .prof file with $ mv stacker.prof stacker.prof.bak;
    3. ./run <cost-centre-num> stacker.prof.bak hie vendor
    4. You should see a list of graph edges in the dependency graph.

Generally, run accepts a cost center number, the .prof file and any number of directories with HIE files. Stacker built with run will generate HIE files for all its dependencies under vendor/hie.

(2020-08-04) Tests + a usable shell/web UI are underway. The results and input process are changing shortly.

About

For a Cabal package, combine a call graph traversal and cost center stacks from GHC executing its dependents to understand how packages are used in the wild

Topics

Resources

License

BSD-3-Clause, BSD-3-Clause licenses found

Licenses found

BSD-3-Clause
LICENSE
BSD-3-Clause
LICENSE_hiedb

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published