【发布时间】:2017-10-18 05:56:49
【问题描述】:
missing module 的原因可能是什么?
$ nix-shell -p haskellPackages.ghc -p haskellPackages.random
给出下面的shell
[nix-shell:~]$ ghci
GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /data/works/dotfiles/ghci
Prelude> import System.Random
<no location info>: error:
Could not find module ‘System.Random’
It is not a module in the current program, or in any known package.
以及nix 安装和使用 Haskell 包的方式是什么?
我以为nixos.haskellPackages.<package> 会自动注册 ghc,但似乎并非如此。
在shell中重新安装random不要修复它。
[nix-shell:~]$ nix-env -iA nixos.haskellPackages.random
installing ‘random-1.1’
[nix-shell:~]$ ghc-pkg list | grep -i random
【问题讨论】:
-
使用开发包的nix方式确实是像你一样通过
nix-shell。 Haskell 可能存在特定问题:我建议您阅读Haskell section of the nixpkgs manual 以了解更多信息。