Haskell how to get code from Hackage into project? Cabal install project failed

117 Views Asked by At

I created a project in hackage that I want to import into my code.

Rather than manually copy-pasting the code from "print-debugger-0.0.tar.gz" into the src folder of my cabal project, I want to be able to do this...

// project.cabal file

name:              project
...
executable project
  main-is:         Main.hs
  hs-source-dirs:  src
  build-depends:   base, split, print-debugger

And do this...

cabal install print-debugger

And import "StackTraceDebug" into my project.

When I try I get messages...

"this package is not installed"
"cabal: There is no package named 'print-debugger'"

How do I get my code out of hackage and into my project without manually copying and pasting?

2

There are 2 best solutions below

2
On

If you have problems with cabal, you might consider trying stack in the future. It's very helpful for coordinating dependencies between projects.

0
On

It appears as though version 0.0 failed to install due to missing files (see: https://hackage.haskell.org/package/print-debugger-0.0/reports/1) but that later versions have fixed this issue and now things should work smoothly.