gpt4 book ai didi

haskell - 为什么 "cabal init"会破坏 "ghc-mod check"?

转载 作者:行者123 更新时间:2023-12-02 10:29:31 27 4
gpt4 key购买 nike

ghc-mod 在只有一个 haskell 源文件的目录中工作,但如果我在该目录(/tmp/test)中运行“cabal init”,则会收到以下错误:

(p1)dave@peach:/tmp/test$ !ghc
ghc-mod check Main.hs
ghc-mod: /tmp/test/dist/setup-config: hGetContents: invalid argument (invalid byte sequence)

这里出了什么问题?

我在 64 位 ubuntu 14.04 计算机上运行 ghc-mod 5.2.11 和 cabal 1.21.1.0。 LANG 环境变量设置为 en_US.UTF-8 (我看到对其他一些问题的答复表明 LANG 设置在这里可能很重要)。我尝试运行 cabal 版本 1.16.0,但没有任何区别。

这是显示更多详细信息的文字记录:

(p1)dave@peach:/tmp/test$ ls -la
total 80
drwxrwxr-x 2 dave dave 4096 Dec 4 07:07 .
drwxrwxrwt 35 root root 69632 Dec 4 07:06 ..
-rw-rw-r-- 1 dave dave 143 Dec 4 07:04 Main.hs

(p1)dave@peach:/tmp/test$ set | grep LANG
GDM_LANG=en_US
LANG=en_US.UTF-8
LANGUAGE=en_US

(p1)dave@peach:/tmp/test$ ghc-mod version
ghc-mod version 5.2.1.1 compiled by GHC 7.6.3

(p1)dave@peach:/tmp/test$ cabal -V
cabal-install version 1.21.1.0
using version 1.21.1.0 of the Cabal library

(p1)dave@peach:/tmp/test$ ghc-mod check Main.hs
Main.hs:7:1:Warning: Top-level binding with no type signature: haqify :: [Char] -> [Char]

(p1)dave@peach:/tmp/test$ cabal init
Package name? [default: test]
Package version? [default: 0.1.0.0]
Please choose a license:
* 1) (none)
2) GPL-2
3) GPL-3
4) LGPL-2.1
5) LGPL-3
6) AGPL-3
7) BSD2
8) BSD3
9) MIT
10) ISC
11) MPL-2.0
12) Apache-2.0
13) PublicDomain
14) AllRightsReserved
15) Other (specify)
Your choice? [default: (none)] 2
Author name? [default: XXXXXXXXXXXX]
Maintainer email? [default: XXXXXXXXXXXXXXXXXXXXXX]
Project homepage URL?
Project synopsis?
Project category:
* 1) (none)
2) Codec
3) Concurrency
4) Control
5) Data
6) Database
7) Development
8) Distribution
9) Game
10) Graphics
11) Language
12) Math
13) Network
14) Sound
15) System
16) Testing
17) Text
18) Web
19) Other (specify)
Your choice? [default: (none)]
What does the package build:
1) Library
2) Executable
Your choice? 2
What is the main module of the executable:
* 1) Main.hs
2) Other (specify)
Your choice? [default: Main.hs]
What base language is the package written in:
* 1) Haskell2010
2) Haskell98
3) Other (specify)
Your choice? [default: Haskell2010]
Include documentation on what each field means (y/n)? [default: n]
Source directory:
* 1) (none)
2) src
3) Other (specify)
Your choice? [default: (none)]

Guessing dependencies...

Generating LICENSE...
Generating Setup.hs...
Generating test.cabal...

Warning: no synopsis given. You should edit the .cabal file and add one.
You may want to edit the .cabal file and add a Description field.

(p1)dave@peach:/tmp/test$ !ghc
ghc-mod check Main.hs
ghc-mod: /tmp/test/dist/setup-config: hGetContents: invalid argument (invalid byte sequence)
(p1)dave@peach:/tmp/test$

最佳答案

<小时/>

ghc-mod doesn't work with GHC < 7.10 and Cabal-1.22.

If you are still on GHC 7.8.3 or 7.8.4, you may want to hold off on updating cabal or cabal-install.

关于haskell - 为什么 "cabal init"会破坏 "ghc-mod check"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27298268/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com