可能是因爲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)以學到更多。 –