The haskell dependency management can be quite intimidating at first,
but after a while you get used to it and realize it's very similar to rust's cargo
(so many things are similar between rust and haskell, by the way).
One of the things I found particularly easy (once you know how) is to edit a dependency locally to work on it.
So imagine you have a cabal project with a dependency:
build-depends: base
, aeson
, hasql
, hasql-pool
If you want to work on hasql-pool
for example, you just have to:
- clone the repo in the (parent) directoy (you can find the git url on its hackage page)
git clone github.com/nikita-volkov/hasql-pool.git ..
- edit your
cabal.project
(didn't work withcabal.project.local
for me)
packages:
./
../hasql-pool/
And that's it!
You can now edit the files in ../hasql-pool
and you'll directly see the results when running cabal repl
or cabal build
.
You could also decide to directly ask cabal to clone the repo and override the default one in your cabal.project
(.local
works too) one using:
source-repository-package
type: git
location: git://github.com/docteurklein/hasql-pool
tag: e1c41a9
-- subdir: sub/path/to/project
You'll need to push your changes and edit the tag
field for every change, which makes it less useful than the local-path option.
Note: This also works if the package is not yet published on hackage.
It's all defined here but sometimes it's pretty hard to find what you want in the cabal documentation.
Hope that helps!