我想在Mac上使用Atom在Haskell中编程。因此我在Atom中安装了以下软件包:
haskell-ghc-mod
ide-haskell
ide-haskell-cabal
language-haskell
之后我从这里安装了Haskell Platform 8.2.1: https://www.haskell.org/platform/#osx-none
这似乎不起作用,因为我无法编译,并且在每次Atom启动时都会出现以下错误消息:
Haskell-ghc-mod: ghc-mod failed to launch. It is probably missing or misconfigured. ENOENT
然后我按照https://atom-haskell.github.io/installation/installing-binary-dependencies/所述尝试手动安装必要的软件包,这也失败了(甚至取消注册失败):
Daniels-MacBook-Pro:ghc-mod-sandbox daniel$ cabal install ghc-mod stylish-haskell
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: ghc-mod-5.8.0.0 (user goal)
next goal: base (dependency of ghc-mod-5.8.0.0)
rejecting: base-4.10.0.0/installed-4.1... (conflict: ghc-mod => base<4.10 &&
>=4.6.0.1)
rejecting: base-4.10.0.0, base-4.9.1.0, base-4.9.0.0, base-4.8.2.0,
base-4.8.1.0, base-4.8.0.0, base-4.7.0.2, base-4.7.0.1, base-4.7.0.0,
base-4.6.0.1, base-4.6.0.0, base-4.5.1.0, base-4.5.0.0, base-4.4.1.0,
base-4.4.0.0, base-4.3.1.0, base-4.3.0.0, base-4.2.0.2, base-4.2.0.1,
base-4.2.0.0, base-4.1.0.0, base-4.0.0.0, base-3.0.3.2, base-3.0.3.1
(constraint from non-upgradeable package requires installed instance)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, ghc-mod, syb
Note: when using a sandbox, all packages are required to have consistent
dependencies. Try reinstalling/unregistering the offending packages or
recreating the sandbox.
Daniels-MacBook-Pro:ghc-mod-sandbox daniel$ cabal uninstall ghc-mod stylish-haskell
cabal: This version of 'cabal-install' does not support the 'uninstall'
operation. It will likely be implemented at some point in the future; in the
meantime you're advised to use either 'ghc-pkg unregister ghc-mod' or 'cabal
sandbox hc-pkg -- unregister ghc-mod'.
Daniels-MacBook-Pro:ghc-mod-sandbox daniel$ ghc-pkg unregister ghc-mod
ghc-pkg: cannot find package ghc-mod
Daniels-MacBook-Pro:ghc-mod-sandbox daniel$ cabal sandbox hc-pkg -- unregister ghc-mod
ghc-pkg: cannot find package ghc-mod
Daniels-MacBook-Pro:ghc-mod-sandbox daniel$ cabal install ghc-mod stylish-haskell
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: ghc-mod-5.8.0.0 (user goal)
next goal: base (dependency of ghc-mod-5.8.0.0)
rejecting: base-4.10.0.0/installed-4.1... (conflict: ghc-mod => base<4.10 &&
>=4.6.0.1)
rejecting: base-4.10.0.0, base-4.9.1.0, base-4.9.0.0, base-4.8.2.0,
base-4.8.1.0, base-4.8.0.0, base-4.7.0.2, base-4.7.0.1, base-4.7.0.0,
base-4.6.0.1, base-4.6.0.0, base-4.5.1.0, base-4.5.0.0, base-4.4.1.0,
base-4.4.0.0, base-4.3.1.0, base-4.3.0.0, base-4.2.0.2, base-4.2.0.1,
base-4.2.0.0, base-4.1.0.0, base-4.0.0.0, base-3.0.3.2, base-3.0.3.1
(constraint from non-upgradeable package requires installed instance)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, ghc-mod, syb
Note: when using a sandbox, all packages are required to have consistent
dependencies. Try reinstalling/unregistering the offending packages or
recreating the sandbox.
我已经在stackoverflow中搜索了答案,但没有什么对我有用。谁能告诉我我错过了什么?
答案 0 :(得分:2)
我可以就问题的一部分向你提出建议。来自cabal
的错误消息非常令人困惑,但它意味着:
ghc-mod
不适用于base
base
库附带GHC且无法更改ghc-mod
您可以通过下载较旧的Haskell平台(8.0.2)来解决此问题。在我看来:升级后的Haskell平台版本为8.2.1还为时过早。
另一种方法是使用Stack,它将为您管理GHC安装的安装。在这种情况下,运行stack install ghc-mod
应正常工作。但是既然你仍然会在Haskell平台上使用GHC 8.2.1,那么gnc-mod与你的GHC版本有关,它对你没有多大帮助。
个人:我从来没有成功设置ghc-mod。我也从未使用过Atom或VS Code,但我听说人们在VS Code + Haskero上分享了很好的经验,所以如果你正在寻找类似IDE的体验,这可能是值得考虑的事情。我已经切换到使用emacs + intero模式,这可能需要考虑。
以下是一些可能有助于开始使用工具的链接: