0

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?

Michael Lafayette
  • 2,972
  • 3
  • 20
  • 54
  • Well, if you *just* uploaded that package, you'll have to do `cabal update` to get it to see it. After doing a `cabal update` I can see your package, however it doesn't build (due to a missing source file). Perhaps you have placed something in the wrong directory? – user2407038 Feb 13 '16 at 02:31
  • @user2407038 - I did do "cabal update". I think my install of build-essentials from the Ubuntu 14.04 software repo is complete crap and I need to get rid of it and install something else. – Michael Lafayette Feb 13 '16 at 04:27
  • Then run `cabal install print-debugger -v3` and see where exactly it fails. – user2407038 Feb 13 '16 at 05:30
  • @user2407038 - Can you try this out for me: https://hackage.haskell.org/package/print-debugger – Michael Lafayette Feb 13 '16 at 05:30
  • Can't do it as you have listed `base <4.8.2.0` as a dependency and I don't have such an old compiler any more. – user2407038 Feb 13 '16 at 05:48
  • @user2407038 I don't understand. "base < 4.8.2.0" means that you can use any base that is less than 4.8.2.0 (the version of base that I am currently using). Do you want me to change it to "base =< 4.8.2.0"? I don't understand. Also, how/where do you specify the compiler? This project requires GHC 7.10.1 (or greater) because of the stack trace. – Michael Lafayette Feb 13 '16 at 06:31
  • Sorry I may have misspoke. I have base-4.8.2.0, so `base<4.8.2.0` will not work for me but `base<=4.8.2.0` will. However, you probably want to specify a *lower* bound, not an upper one, for the first version which had stack traces. You can't specify the version of the compiler, but the version of the `base` library is completely tied to the compiler version. – user2407038 Feb 13 '16 at 07:40

2 Answers2

0

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.

sclv
  • 38,665
  • 7
  • 99
  • 204
-1

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

Colin Woodbury
  • 1,799
  • 2
  • 15
  • 25
  • ^ Can you try this out for me: https://hackage.haskell.org/package/print-debugger – Michael Lafayette Feb 13 '16 at 05:30
  • I should have been clearer. `stack` uses https://www.stackage.org. Unless your package has been uploaded to stackage, you would need to add it to the `extra-deps` field in your `stack.yaml` config file for the project that uses it. Then it pulls it from hackage instead. – Colin Woodbury Feb 13 '16 at 20:49