从堆栈安装ghcjs

时间:2016-05-16 13:07:54

标签: haskell haskell-stack ghcjs

我通过堆栈安装GHC(以便stack ghc -- --version显示GHC-7.10.3)

$ stack install ghcjs

Run from outside a project, using implicit global project config
Using resolver: lts-5.2 from implicit global project's config file: /home/john/.stack/global-project/stack.yaml
The following target packages were not found: ghcjs

有些资源建议 ghcjs 有点实验性(尽管在后续阶段)。

看着http://docs.haskellstack.org/en/stable/ghcjs/我想也许我能找到stack.yaml并改变它。

  

要使用堆栈> = 0.1.8的GHCJS,请将GHCJS版本放在stack.yaml的编译器字段中......然后stack setup

$ cat ~/.stack/global-project/stack.yaml
# This is the implicit global project's config file, which is only used when
# 'stack' is run outside of a real project.  Settings here do _not_ act as
# defaults for all projects.  To change stack's default settings, edit
# '/home/john/.stack/config.yaml' instead.
#
# For more information about stack's configuration, see
# http://docs.haskellstack.org/en/stable/yaml_configuration.html
#
flags: {}
extra-package-dbs: []
packages: []
extra-deps: []
resolver: lts-5.2

我们被告知看config.yaml看起来同样空白。这是否正确,我是否会走向死胡同?

$ cat ~/.stack/config.yaml
# This file contains default non-project-specific settings for 'stack', used
# in all projects.  For more information about stack's configuration, see
# http://docs.haskellstack.org/en/stable/yaml_configuration.html
#
{}

我只想在堆栈中安装 ghcjs

1 个答案:

答案 0 :(得分:9)

查看此页面:http://docs.haskellstack.org/en/stable/ghcjs/

我会尝试:

  1. 启动新的堆栈项目,例如stack new js-test

  2. 通过添加此节来修改stack.yaml文件(取自上面提到的链接):

    compiler: ghcjs-0.2.0.20160414_ghc-7.10.3
    compiler-check: match-exact
    setup-info:
      ghcjs:
        source:
          ghcjs-0.2.0.20160414_ghc-7.10.3:
            url: https://s3.amazonaws.com/ghcjs/ghcjs-0.2.0.20160414_ghc-7.10.3.tar.gz
            sha1: 6d6f307503be9e94e0c96ef1308c7cf224d06be3
    
  3. resolver:更改为lts-5.12 - 这与上述节相匹配。

  4. 运行stack setup以安装编译器。

  5. 第4步需要一段时间。