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?
You can just run
stack dotcommand 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