繁体   English   中英

Haskell ghc-mod失败并出错

[英]Haskell ghc-mod fails with error

我只有麻烦使用阴谋,不确定是由于缺乏理解,还是错误的心理模型,但事情很艰难。

目前我只是想让ghc-mod为我的vim插件工作。 它通常可以工作一两天,然后开始因为看似没有错误的原因而失败,我收到的错误似乎不时改变,现在我得到这个:

$ ghc-mod check Main.hs
ghc-mod: /Users/chris/.stack/snapshots/x86_64-osx/lts-6.15/7.10.3/pkgdb/package.cache: 
GHC.PackageDb.readPackageDb: inappropriate type (Not a valid Unicode code point!)

关于如何解决这类问题的任何想法? 我已经尝试过再次安装它,但我得到了这个(我认为我的cabal包都搞砸了但不知道如何解决它):

$ cabal install ghc-mod
Resolving dependencies...
Downloading haskell-src-exts-1.17.1...
Configuring haskell-src-exts-1.17.1...
Failed to install haskell-src-exts-1.17.1
Build log ( /Users/chris/.cabal/logs/haskell-src-exts-1.17.1.log ):
cabal: Entering directory '/var/folders/6l/rdh2g5wn41s8vxchngkt02_c0000gn/T/cabal-tmp-45583/haskell-src-exts-1.17.1'
Configuring haskell-src-exts-1.17.1...
cabal: The program 'happy' version >=1.19 is required but it could not be
found.
cabal: Leaving directory '/var/folders/6l/rdh2g5wn41s8vxchngkt02_c0000gn/T/cabal-tmp-45583/haskell-src-exts-1.17.1'
cabal: Error: some packages failed to install:
ghc-mod-5.6.0.0 depends on haskell-src-exts-1.17.1 which failed to install.
haskell-src-exts-1.17.1 failed during the configure step. The exception was:
ExitFailure 1
hlint-1.9.35 depends on haskell-src-exts-1.17.1 which failed to install.

编辑:看了一会儿又试了一遍,现在我收到了这个错误,总是厌倦了cabal一直在改变它的想法:

$ ghc-mod check Main.hs
[1 of 5] Compiling CabalHelper.Common ( CabalHelper/Common.hs, /Users/chris/.ghc-mod/cabal-helper/CabalHelper/Common.o  )
[2 of 5] Compiling CabalHelper.Licenses ( CabalHelper/Licenses.hs, /Users/chris/.ghc-mod/cabal-helper/CabalHelper/Licenses.o  )

CabalHelper/Licenses.hs:53:18: error:
Ambiguous occurrence ‘lookupInstalledPackageId’
It could refer to either ‘Distribution.Simple.PackageIndex.lookupInstalledPackageId’,
imported from ‘Distribution.Simple.PackageIndex’ at CabalHelper/Licenses.hs:24:1-39
or ‘CabalHelper.Licenses.lookupInstalledPackageId’,
defined at CabalHelper/Licenses.hs:38:1

CabalHelper/Licenses.hs:74:10: error:
Ambiguous occurrence ‘lookupInstalledPackageId’
It could refer to either ‘Distribution.Simple.PackageIndex.lookupInstalledPackageId’,
imported from ‘Distribution.Simple.PackageIndex’ at CabalHelper/Licenses.hs:24:1-39
or ‘CabalHelper.Licenses.lookupInstalledPackageId’,
defined at CabalHelper/Licenses.hs:38:1
ghc-mod: readCreateProcess: /Users/chris/.stack/snapshots/x86_64-osx/lts-6.15/7.10.3/libexec/cabal-helper-wrapper "--with-ghc=/usr/local/bin/ghc" "--with-ghc-pkg=/usr/local/bin/ghc-pkg" "--with-cabal=cabal" "/Users/chris/dev/formatter" "/Users/chris/dev/formatter/.stack-work/dist/x86_64-osx/Cabal-1.24.0.0" "package-db-stack" "entrypoints" "source-dirs" "ghc-options" "ghc-src-options" "ghc-pkg-options" "ghc-merged-pkg-options" "ghc-lang-options" "licenses" "flags" "config-flags" "non-default-config-flags" "compiler-version" (exit 1): failed

这个错误是由于我的本地堆栈ghc版本与全局ghc-mod ghc版本不匹配引起的,我将堆栈项目中的ghc版本更新为最新版本,一切正常。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM