haskell - 如何在堆栈中使用 haste/hplayground

标签 haskell haste

我对 Haskell 这种语言有些熟悉,但对工具链不太熟悉。 (在 cabal 和 stack 存在之前,我曾使用 Haskell。)有人告诉我,stack 是我应该用来管理 Haskell 项目的工具。我正在尝试学习 haste 库,但我在尝试的第一个教程中遇到了困难,因为我无法安装 hplayground。我创建了一个堆栈项目;我的 stack.yaml 有

extra-deps:
- ghc-simple-0.3
- haste-compiler-0.5.3
- shellmate-0.2.3
- haste-perch-0.1.0.9
- hplayground-0.1.3.1

我的 .cabal 文件在 build-depends 中列出了 hplayground。但是当我运行 stack build 时,我得到了这些错误:
Configuring haste-perch-0.1.0.9...
Building haste-perch-0.1.0.9...
Preprocessing library haste-perch-0.1.0.9...

Haste/Perch.hs:17:15: Warning:
    -XOverlappingInstances is deprecated: instead use per-instance pragmas OVERLAPPING/OVERLAPPABLE/OVERLAPS

Haste/App/Perch.hs:18:15: Warning:
    -XOverlappingInstances is deprecated: instead use per-instance pragmas OVERLAPPING/OVERLAPPABLE/OVERLAPS
[1 of 2] Compiling Haste.App.Perch  ( Haste/App/Perch.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/Haste/App/Perch.o )

Haste/App/Perch.hs:61:15: Not in scope: ‘newTextElem’

Haste/App/Perch.hs:71:9:
    Not in scope: ‘setAttr’
    Perhaps you meant ‘jsSetAttr’ (imported from Haste.App)

Haste/App/Perch.hs:76:15:
    Not in scope: ‘newElem’
    Perhaps you meant one of these:
    ‘nelem’ (line 75), ‘notElem’ (imported from Prelude)

以及很多类似的错误。对我做错了什么有任何想法吗?

更广泛地说:对于没有使用 Haskell 工具链的人来说,有什么快速、简单的方法可以快速启动和运行?

最佳答案

Haste 的事件 API 在 0.4 和 0.5 系列之间进行了大修,而 HPlayground 仍然在 0.4 上。如果你想使用它,不幸的是你不得不回退到 0.4,直到 HPlayground 被修补为 0.5。

一般来说,您应该安装 pre-build binaries如果您在非 Linux 平台上(如果您也在 Linux 平台上,因为您可以获得手册页和其他细节);构建过程可能很棘手并且容易出错。

完成后,您可以引用 docs and resources haste-lang.org 上的页面,其中包含指向 API 文档、视频教程、源代码示例等的链接。

关于haskell - 如何在堆栈中使用 haste/hplayground,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36109550/

相关文章:

javascript - Haste Haskell->JS 编译器无法在 OSX 上运行,调用 hastec 时显示特定错误消息

haskell - 让 Haskell 区分类型同义词

haskell - GHCJS/Haste 可以自己编译吗?

haskell - 是否可以使用 Ghcjs、Haste、Elm 等在服务器端渲染 Haskell 前端?

haskell - Haskell 任务的 Makefile 示例

reactjs - 无法解析模块...急速模块图中不存在

带 (++) 的 haskell 折叠

Haskell 函数式编程,函数作为参数

arrays - 在 Haskell 中就地修改数组?