Reputation: 3387
Assume I want to creat my own local library called MyLib, my workflow is:
$ cabal init
# # edit the ".cabal" file, set the "exposed-modules" as "MyLib"
# # edit "MyLib.hs" located in "src"
$ cabal sandbox init
$ cabal install
So my question is
import MyLib
from my another haskell project? It seems that packages downloaded from hackage through cabal install
are stored in ~/.cabal, while my own locally installed package is not there.cabal build
and cabal install
, it seems that after running cabal build
, I could already run my lib through cabal repl
, so what extra jobs does cabal install
do?Upvotes: 2
Views: 257
Reputation: 5305
I've never used cabal sandbox
so I can't speak much to it.
cabal build
compiles your source code into your dist
directory.
cabal install
takes your compiled source code and sends it to your ~/.cabal
directory, and registers it in your ~/.ghc
directory. Now you can import
it into other code just as you would any other library you've installed with cabal.
In my personal projects, I use cabal configure
, cabal build
, cabal repl
, and cabal install
. And configure
is kind of optional.
Upvotes: 2