可能是因为missing module
?在nix-shell中找不到模块
$ 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
方式?
我以为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
使用开发包的尼克斯方式的确是要经过'尼克斯,shell'样你做到了。 Haskell可能存在特定的问题:我建议您阅读nixpkgs手册的[Haskell部分](https://nixos.org/nixpkgs/manual/#users-guide-to-the-haskell-infrastructure)以学到更多。 –