Can not load a file that uses standard libraries in haskell

后端 未结 2 1409
忘了有多久
忘了有多久 2021-01-21 05:18

Hi I use GHCI and can normally load my files. Now I need to load a file that uses random. I get this error.

Chatterbot.hs:3:1: error:
    Could not find module ‘         


        
2条回答
  •  旧时难觅i
    2021-01-21 05:26

    The System.Random module is part of the random package, not of the base package. You thus should install it. If you for example use cabal, you can install it with cabal install random.

    If you use Haskell stack for example, you can add it to your package-name.cabal file:

      -- …
      build-depends:
          base >=4.7 && <5
        , random >=1.0 && <2

提交回复
热议问题