4

By running stack ide targets, I can get a list of all the targets in a stack project. For example, for Halive, I get:

halive:lib
halive:exe:halive
halive:test:compileexpr
halive:test:demo
halive:test:subhalive
halive:test:testghc
halive:test:unit

I'd like to now if there's a way we can ask stack, intero, or some other tool, which targets a target depends on.

For example, in this scenario, I'd like stack/intero/whatever to tell me that halive:test:unit depends on halive:lib.

In case that's not possible, I guess I can try inspecting the .cabal file myself... is there a parser or a tool or something that could give me something like that?

dcastro
  • 66,540
  • 21
  • 145
  • 155

1 Answers1

0

You can just run stack dot command to build dependency graph for your project and then analyze this graph by yourself. I think your task is rather specific. Just a single analyzing algorithm for dependency graph. Probably not so common so it's not implemented yet (maybe it's implemented, but I'm not aware of it).

See details here:

Use “stack dot” to see which of your deps bring a particular package to your dependency tree

Shersh
  • 9,019
  • 3
  • 33
  • 61
  • It doesn't seem to be working the way I expected... https://gist.github.com/dcastro/05d1076e3cd134a1bc473f77e401998d – dcastro Dec 13 '17 at 10:52
  • 1
    Hmm, you're right. This command doesn't show dependencies on internal modules :( Probably you can open feature request in `stack` repository for this. – Shersh Dec 13 '17 at 18:11