purescript - Purescript 0.12 入门
问题描述
我正在尝试运行非常基本的流程:
1)安装工具:
npm install -g 纸浆凉亭
Pulp 版本 12.2.0 purs 版本 0.12.0 使用 C:\Users\panda.psvm\current\bin\purs.EXE C:\Users\panda>bower --version 1.8.4
2)按照这个答案的步骤我安装了purs https://stackoverflow.com/a/50554135/1358421
C:\Users\panda>purs --version 0.12.0
好的,让我们创建一个项目。
c:\home\projects\sandbox\purr>mkdir hello-purr
c:\home\projects\sandbox\purr>cd hello-purr
c:\home\projects\sandbox\purr\hello-purr> 纸浆初始化
c:\home\projects\sandbox\purr\hello-purr>pulp init
* Generating project skeleton in c:\home\projects\sandbox\purr\hello-purr
bower purescript-console#* cached https://github.com/purescript/purescript-console.git#4.1.0
bower purescript-console#* validate 4.1.0 against https://github.com/purescript/purescript-console.git#*
bower purescript-prelude#* cached https://github.com/purescript/purescript-prelude.git#4.0.0
bower purescript-prelude#* validate 4.0.0 against https://github.com/purescript/purescript-prelude.git#*
bower purescript-prelude#^4.0.0 cached https://github.com/purescript/purescript-prelude.git#4.0.0
bower purescript-prelude#^4.0.0 validate 4.0.0 against https://github.com/purescript/purescript-prelude.git#^4.0.0
bower purescript-effect#^2.0.0 cached https://github.com/purescript/purescript-effect.git#2.0.0
bower purescript-effect#^2.0.0 validate 2.0.0 against https://github.com/purescript/purescript-effect.git#^2.0.0
bower purescript-console#^4.1.0 install purescript-console#4.1.0
bower purescript-prelude#^4.0.0 install purescript-prelude#4.0.0
bower purescript-effect#^2.0.0 install purescript-effect#2.0.0
purescript-console#4.1.0 bower_components\purescript-console
├── purescript-effect#2.0.0
└── purescript-prelude#4.0.0
purescript-prelude#4.0.0 bower_components\purescript-prelude
purescript-effect#2.0.0 bower_components\purescript-effect
└── purescript-prelude#4.0.0
bower purescript-psci-support#* cached https://github.com/purescript/purescript-psci-support.git#4.0.0
bower purescript-psci-support#* validate 4.0.0 against https://github.com/purescript/purescript-psci-support.git#*
bower purescript-psci-support#^4.0.0 install purescript-psci-support#4.0.0
purescript-psci-support#4.0.0 bower_components\purescript-psci-support
├── purescript-console#4.1.0
├── purescript-effect#2.0.0
└── purescript-prelude#4.0.0
项目骨架成功生成。
尝试运行它:
纸浆运行
* Building project in c:\home\projects\sandbox\purr\hello-purr
Error 1 of 2:
in module Main
at src\Main.purs line 4, column 1 - line 4, column 31
Module Control.Monad.Eff was not found.
Make sure the source file exists, and that it has been provided as an input to the compiler.
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 Main
at src\Main.purs line 5, column 1 - line 5, column 48
Module Control.Monad.Eff.Console was not found.
Make sure the source file exists, and that it has been provided as an input to the compiler.
See https://github.com/purescript/documentation/blob/master/errors/ModuleNotFound.md for more information,
or to contribute content related to this error.
* ERROR: Subcommand terminated with exit code 1
没运气 :(
纸浆测试
纸浆构建
同样的错误 - 它找不到模块。我错过了什么?请指教。谢谢
解决方案
Purescript 0.12 引入了较新版本的效果和控制台库,不幸的是,pull init 尚未更新以更正生成的示例以匹配(请参阅https://github.com/purescript-contrib/pulp/issues/337)
只需将 Main.purs 中的代码更新为:
module Main where
import Prelude (Unit)
import Effect
import Effect.Console (log)
main :: Effect Unit
main = do
log "Hello sailor!"`
开始。
推荐阅读
- yarnpkg - 为什么在使用 Yarn 全局安装时 nx serve 不起作用?
- css - 模态不会在点击时出现,但会在点击时消失就好了
- python-3.x - 使用 TOML 配置文件和字典
- c++ - 计算“atmost K”和“atmost K-1”值以获得“等于 K”答案的直觉
- php - 如何在 Ubuntu 16.04.7 LTS 上安装 php5.6-redis
- javascript - 为什么我得到“.at”不是一个函数?
- python - 在 WSL 中运行 python 脚本时没有这样的文件或目录
- firebase - 错误:无效参数:在 URI 文件中未指定主机:///null
- maven - Jenkins 中 Cargo Container 中的 Tomcat 下载问题
- html - 如何对齐 3 个跨度但将一个推低一点