missing module的原因是什么?
$ nix-shell -p haskellPackages.ghc -p haskellPackages.random给出以下壳
[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.和安装和使用Haskell软件包的方法是什么?
我以为nixos.haskellPackages.<package>会自动注册ghc,但情况似乎并非如此。
重新安装外壳中的random不要修复它。
[nix-shell:~]$ nix-env -iA nixos.haskellPackages.random
installing ‘random-1.1’
[nix-shell:~]$ ghc-pkg list | grep -i random发布于 2017-05-18 12:17:58
我不知道为什么这不管用。但您可以尝试以下命令:
nix-shell -p "haskellPackages.ghcWithPackages (pkgs: with pkgs; [random])"为我工作。现在ghci看到了System.Random包。
更新:
这篇文章对于初学者在nix + haskell冒险中非常有帮助:
https://stackoverflow.com/questions/44047412
复制相似问题