0

When I try to install Haskell's scientific package using stack, it returns with no input as if scientific is already installed.

$ stack install scientific
$

and yet scientific is not installed.

Listing installed packages with $ ghc-pkg list returns no match.

$ ghc-pkg list | grep scientific
$

And furthermore, there is no directory on my entire system named scientific, as shown by the empty result of this find command.

$ find / -name scientific 2>/dev/null
$

Why is $ stack install scientific failing to install scientific?

I am using NixOS 17.03.

mherzl
  • 5,624
  • 6
  • 34
  • 75
  • 1
    How about trying `stack exec -- ghc-pkg describe scientific`? Stack installs libraries to package dbs that are not globally visible. Within `stack exec`, it sets the GHC_PACKAGE_PATH environment variable, so that tools like ghc-pkg and ghc will see the package. – mgsloan Jul 23 '17 at 03:30
  • @mgsloan following your suggestion and using `stack exec` (e.g. `stack exec -- ghc-pkg list`) I *am* able to see an use `scientific`. For example, running `$ stack exec -- ghci` I am able to `import Data.Scientific`. Why doesn't stack just install to be 'globally visible', and how can I make `scientific` globally visible? I'd like to be able to just run `$ ghci` (without the `stack exec`) and have `scientific` be available as with my other packages. – mherzl Jul 23 '17 at 13:45
  • If you're using `stack install` outside of a project, it installs the package globally for `stack`. It then should be available via `stack ghci` – Simon Jul 24 '17 at 22:54
  • @mherzl Stack sandboxes things by design. For anything more than misc experiments, not having sandboxes quickly becomes untenable. You can use "stack exec bash" to enter into a shell that allows you to run ghci straight. Main crucial thing is having GHC_PACKAGE_PATH set. – mgsloan Jul 25 '17 at 21:14

0 Answers0