So my folder structure is like this
.
├── eulerlibs
│ ├── EulerLibs
│ └── eulerlibs.cabal
├── flake.lock
├── flake.nix
├── p001
│ ├── Main.hs
│ └── p001.cabal
├── p002
│ ├── Main.hs
│ └── p002.cabal
├── p003
│ ├── Main.hs
│ └── p003.cabal
├── p004
│ ├── Main.hs
│ └── p004.cabal
├── p005
│ ├── Main.hs
│ └── p005.cabal
What I am trying to do is import the library modules in the ./eulerlibs
(library) cabal directory to lets say ./p005
(executable) cabal directory
I do understand that I can include built libraries (*.so), but can find no way of linking two cabal projects
I'm very new to cabal as well as haskell so some insight will be much appreciated. If nothing works out I'll have to add the library to p005 itself which I really want to avoid.
You can do this with a
cabal.project
file. Place it at the top level (in the.
directory) with these contents:Then you will be able to use all those libraries in each other's cabal files in the build-dependencies, e.g. in
p001.cabal
:Here is the full documentation of
cabal.project
files: https://cabal.readthedocs.io/en/latest/cabal-project.html