首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在nix-shell中找到模块。

无法在nix-shell中找到模块。
EN

Stack Overflow用户
提问于 2017-05-18 12:10:47
回答 1查看 814关注 0票数 3

missing module的原因是什么?

代码语言:javascript
复制
$ nix-shell -p haskellPackages.ghc -p haskellPackages.random

给出以下壳

代码语言:javascript
复制
[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不要修复它。

代码语言:javascript
复制
[nix-shell:~]$ nix-env -iA nixos.haskellPackages.random
installing ‘random-1.1’

[nix-shell:~]$ ghc-pkg list | grep -i random
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-05-18 12:17:58

我不知道为什么这不管用。但您可以尝试以下命令:

代码语言:javascript
复制
nix-shell -p "haskellPackages.ghcWithPackages (pkgs: with pkgs; [random])"

为我工作。现在ghci看到了System.Random包。

更新:

这篇文章对于初学者在nix + haskell冒险中非常有帮助:

https://web.archive.org/web/20170910171927/http://alpmestan.com/posts/2017-09-06-quick-haskell-hacking-with-nix.html

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44047412

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档