Open mgsloan opened 8 years ago
I think most of this functionality is covered by hpack-convert, although with a different approach.
The auto-updating would be nice though…
It is! I would love it if hpack-convert were an official part of the project, though.
This is a bit of a hack idea, but I think it could work well:
1) Based on source directories, it would discover haskell modules using the existing hpack logic. It'd also guess that the project name is the name of the current dir.
2) Generate an hpack file with these fields filled in, but just a dependency on
base
.3) Iteratively run the compiler and parse out
import
resolution failures. Find the package in someMap ModuleName [PackageName]
, and ask the user when there's ambiguity.The module name map could come from the stackage snapshot you've picked, or some other source like the latest hackage. For stack integration, the fanciest thing would be to fall back on looking it up in hackage, and add extra-deps as necessary.
It'd also be quite fancy if this could update an existing hpack file, perhaps based on errors the user encounters in their editor's ghci session