Search code examples
haskellcabalghc-mod

ghc-mod doesn't see System.Random


After cabal install random, I try ghc-mod list but it still doesn't see the package.

cabal --version
cabal-install version 1.22.6.0
using version 1.22.4.0 of the Cabal library 

ghc-mod --version
ghc-mod version 5.5.0.0 compiled by GHC 7.10.3 

I have now also tried adding random-1.1 to my global stack.yaml (trying to make a simple script here...) and installed via stack install random to no avail.

My file seems to run fine with runhaskell though.


Solution

  • When you type stack install random, and then run stack ghci or install with stack, the import succeeds

    > import System.Random  --succeeds
    

    If you run ghc outside of stack, it won't necessarily use the same setup.