【发布时间】:2018-02-16 01:37:17
【问题描述】:
我正在尝试在NixOs 上使用purescript 设置hello world 项目并且有几个问题,
-
Official
purescript网站推荐通过npm安装但没有nixos.nodePackages.purescript,而是我在nixpkgs中找到了至少2 个变体- nixos.purescript
- nixos.haskellPackages.purescript
有什么不同?
- 官网推荐
pulp和bowervianpm,但只有nodePackages.bower可用,还有未记录的psc-package。
nix 处理纯脚本包的方式应该是什么?
- 官方网站上的示例代码(见
hello.pursbellow)甚至无法编译,
出现这些错误。
$ purs compile hello.purs
Error found:
at hello.purs line 1, column 1 - line 1, column 1
Unable to parse module:
unexpected "import"
expecting "module"
我将module Hello 添加到代码中,但仍然失败。
$ purs compile hello.purs
Error 1 of 2:
in module Hello
at hello.purs line 2, column 1 - line 2, column 15
Module Prelude was not found.
Make sure the source file exists, and that it has been provided as an input to psc.
See https://github.com/purescript/documentation/blob/master/errors/ModuleNotFound.md for more information,
or to contribute content related to this error.
Error 2 of 2:
in module Hello
at hello.purs line 3, column 1 - line 3, column 39
Module Control.Monad.Eff.Console was not found.
Make sure the source file exists, and that it has been provided as an input to psc.
See https://github.com/purescript/documentation/blob/master/errors/ModuleNotFound.md for more information,
or to contribute content related to this error.
正确的工作流程应该是怎样的?
我们的目标是拥有一个带有单个 hello.purs 的最小示例项目
在网络浏览器中运行。
这是hello.purs
module Hello where
import Prelude
import Control.Monad.Eff.Console (log)
greet :: String -> String
greet name = "Hello, " <> name <> "!"
main = log (greet "World")
如果您还可以为nix-shell 或default.nix 为nix-build 提供shell.nix,那将非常有帮助。
找到这个 2 岁的 guild,我正在尝试,但我仍然没有回答所有问题。
【问题讨论】:
-
Justin Woo 的
easy-purescript-nix项目可能也有帮助,这里的 his announcement 也是如此。
标签: purescript nix nixos