I am building a Haskell library with Cabal that I would like to install to use in some other projects. I am using Windows PowerShell and new style Cabal commands. I have ghc 8.10.1 and Cabal 3.2.0.0 and used Chocolatey to install them. cabal new-install --lib
builds and installs the library just fine and without warnings. From --verbose
output I noticed that Cabal mentions folder C:\Users\Liisi\AppData\Roaming\cabal\store\ghc-8.10.1\package.db
and it does contain my package.
However, when I try to compile a test project that consists of a single Haskell file that uses this library, ghc can't find the library. (The test project is not itself a Cabal project since I intend to use the library for tiny, mostly single-file projects.)
ghc Test.hs
and ghc --make Test.hs
both fail to find the library. ghc-pkg list
does not list the name of my library. In another question (which was probably the wrong question to ask) I got the suggestion to try ghc -package-env=C:\Users\Liisi\.ghc\x86_64-mingw32-8.10.1\environments\default --make
and this one does work - however, it would defeat the main purpose of making the library a Cabal project (convenience and usability).
I've also had an opportunity to test my package on OSX and everything worked as expected. So it's probably a Windows-specific issue.