标签: ghc-mod

GHC-mod是否必须使用类型的全名?

我正在尝试使用ghc-modvim插件进行类型/语法检查等.但是,我发现ghc-mod总是在错误消息中使用完整的类型路径,例如:

test.hs|71 col 13 error| Couldn't match type ‘Data.Text.Internal.Text’                                                                                   
||                with ‘[GHC.Types.Char]’
|| Expected type: containers-0.5.6.2:Data.Map.Base.Map
||                  [GHC.Types.Char]
||                  ([(integer-gmp-1.0.0.0:GHC.Integer.Type.Integer,
||                     integer-gmp-1.0.0.0:GHC.Integer.Type.Integer)],
||                   containers-0.5.6.2:Data.Set.Base.Set
||                     integer-gmp-1.0.0.0:GHC.Integer.Type.Integer)
||   Actual type: containers-0.5.6.2:Data.Map.Base.Map
||                  Data.Text.Internal.Text
||                  ([(integer-gmp-1.0.0.0:GHC.Integer.Type.Integer,
||                     integer-gmp-1.0.0.0:GHC.Integer.Type.Integer)],
||                   containers-0.5.6.2:Data.Set.Base.Set
||                     integer-gmp-1.0.0.0:GHC.Integer.Type.Integer)
|| In the second argument of ‘containers-0.5.6.2:Data.Map.Base.map’, namely
||   ‘zippedMap’
|| In the second argument of ‘(GHC.Base.$)’, namely
||   ‘containers-0.5.6.2:Data.Map.Base.map
...
Run Code Online (Sandbox Code Playgroud)

这会使屏幕变得杂乱,我很难找出哪里出了问题.作为比较,这是使用以下内容的同一文件的错误消息ghci:

test.hs:71:13:
    Couldn't match type ‘T.Text’ with ‘[Char]’
    Expected type: M.Map [Char] ([(Integer, …
Run Code Online (Sandbox Code Playgroud)

haskell ghc ghc-mod

143
推荐指数
1
解决办法
1629
查看次数

IntelliJ Haskell插件:ghc-modi因错误而失败

我刚安装了IntelliJ的想法和官方的Haskell插件.IntelliJ找不到ghc-modi.exe,所以我通过cabal安装了ghc-mod.

但是,在导入我的cabal项目后,我仍然收到以下错误:

ghc-modi失败并出现错误:NG BUG:GMECabalFlags(GMEString"extractField:从输入中提取configFlags失败,输入包含`configFlags'?False")

如何解决或获取有关此错误的更多信息?

提前致谢.

haskell intellij-idea ghc ghc-mod

9
推荐指数
1
解决办法
1428
查看次数

ghc-mod只显示*GHC信息中的第一行*

我在haskell模式下使用emacs(24.3.1)和ghc-mod一起玩Haskell.现在一切都很好,除了一件烦人的事情:

GHC信息缓冲区中的每个输出仅包含第一行.

例如,当我要求ghc-show-info(比方说在sqlSettings坚持)我得到这样的:

在此输入图像描述

Interactive-Haskell工作正常:

在此输入图像描述

所有事情都会发生:信息,错误,警告等.

现在我不知道是什么导致了这个问题,因为似乎emacs中的ghc-mod正在解析输出错误.

也许有人可以帮助我获取所有信息.

谢谢

PS:也许这个显示问题好一点:

在此输入图像描述

代替

在此输入图像描述

emacs haskell ghc-mod

8
推荐指数
1
解决办法
166
查看次数

如何在`ghc-mod`中使用`cabal repl`而不是`ghci`?

我想使用cabal repl代替ghci(.我的目标是能够在我的项目中使用其他模块).

emacs haskell cabal emacs24 ghc-mod

7
推荐指数
1
解决办法
1318
查看次数

由于'happy'无法安装,无法安装ghc-mod?

在Mac OS X上,ghc-mod由于无法安装名为"happy"的依赖项,我无法安装:

bash> cabal install ghc-mod                                                                                           
Resolving dependencies...
Configuring haskell-src-exts-1.17.1...
Failed to install haskell-src-exts-1.17.1
Build log ( /Users/meng/.cabal/logs/haskell-src-exts-1.17.1.log ):
Configuring haskell-src-exts-1.17.1...
setup-Simple-Cabal-1.22.5.0-x86_64-osx-ghc-7.10.3: The program 'happy' version
>=1.19 is required but it could not be found.
cabal: Error: some packages failed to install:
ghc-mod-5.5.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.31 depends on haskell-src-exts-1.17.1 which failed to install.
Run Code Online (Sandbox Code Playgroud)

任何的想法?

installation haskell ghc-mod

7
推荐指数
2
解决办法
1525
查看次数

堆栈安装ghc-mod失败,OSX 10.13.4上存在依赖冲突

当我尝试通过堆栈安装ghc-mod时,我最终会遇到这些依赖性冲突

Error: While constructing the build plan, the following exceptions were encountered:

In the dependencies for ghc-mod-5.8.0.0:
    Cabal-2.0.1.1 from stack configuration does not match >=1.18 && <1.25  (latest matching version is 1.24.2.0)
    base-4.10.1.0 from stack configuration does not match >=4.6.0.1 && <4.10  (latest matching version is 4.9.1.0)
    cabal-helper must match <0.8 && >=0.7.3.0, but the stack configuration has no specified version  (latest matching version is 0.7.3.0)
    extra-1.6.8 from stack configuration does not match <1.6 && >=1.4  (latest matching version is …
Run Code Online (Sandbox Code Playgroud)

haskell hlint ghc-mod haskell-stack

7
推荐指数
1
解决办法
1308
查看次数

vim:保存时调用函数

我在vim中使用ghc-mod,并希望每次保存文件时调用GhcModCheck(:GhcModCheck)(:w).你能告诉我如何实现这一目标吗?我想有一个更普遍的问题:如何在保存时调用函数?

谢谢!

vim haskell ghc-mod

6
推荐指数
1
解决办法
770
查看次数

GHC-mod在错误的目录中查找设置文件

我在我的编辑器(Neovim)中使用了许多Haskell插件,其中之一就是在编写Haskell代码ghcmod-vim时与它一起syntastic提供语法检查.

有一次,我已经为Mac OS X安装了GHC,作为构建系统配置中许多问题的临时解决方法.这些问题已经修复,所以我.app从我的包中/Applications删除了它并删除了它附加到我的行~/.zshrc.

出于某种原因,即使是现在,当我编写Haskell文件并将其保存到磁盘时,我在Neovim的消息缓冲区中收到错误:

"myfile.hs" 10L, 163C written
syntastic: error: checker output:
/Applications/ghc-7.8.4.app/Contents/lib/ghc-7.8.4/settings: openFile: does not exist (No such file or directory)
syntastic: error: checker haskell/ghc_mod returned abnormal status 1
Run Code Online (Sandbox Code Playgroud)

settings文件包含具有各种构建环境选项的键/值对列表,这些选项通常与ghc二进制文件一起存储,并且与ghc/usr/local/bin使用Homebrew安装的二进制文件一起存在.

出于某种原因,无论是syntasticghc_mod检查模块正在寻找在错误的地方设置文件.尽管事实上我的任何Neovim或插件配置文件或任何环境变量都没有引用此路径.

如何在正确的位置获取ghc_modsyntastic查找GHC设置文件?

haskell syntastic neovim ghc-mod

5
推荐指数
1
解决办法
327
查看次数

无法在本地安装ghc-mod

我在我的MacOS上安装了ghc 8.2.1.但是我的全局ghc-mod仍在使用8.0.2,因为我最近将ghc升级到8.2.1.我想升级ghc-mod.我尝试了以下命令,它返回错误如下:

? ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.2.1

? ghc-mod --version
ghc-mod version 5.7.0.0 compiled by GHC 8.0.2

? stack build --copy-compiler-tool ghc-mod hoogle weeder

Error: While constructing the build plan, the following exceptions were encountered:

In the dependencies for ghc-mod-5.8.0.0:
    Cabal-2.0.1.1 from stack configuration does not match >=1.18 && <1.25 (latest matching version is 1.24.2.0)
    base-4.10.1.0 from stack configuration does not match >=4.6.0.1 && <4.10 (latest matching version is 4.9.1.0) …
Run Code Online (Sandbox Code Playgroud)

haskell ghc ghc-mod

5
推荐指数
0
解决办法
829
查看次数

原子编辑器的ide-haskell不起作用

我正在尝试将Ide-Haskell包用于atom,但由于某种原因,它不起作用.

首先,我在沙箱下安装了ghc-mod和时尚的haskell ~/lib/.这是我的config.cson文件的样子:

athan@THETA ~> cat ~/.atom/config.cson
'global':
  'exception-reporting':
    'userId': '3b5a8a6c-7778-b310-6a5f-d8ecc314b30f'
  'welcome':
    'showOnStartup': false
  'core':
    'themes': [
      'atom-dark-ui'
      'seti-syntax'
    ]
  'ide-haskell':
    'ghcModPath': '/home/athan/lib/ghc-mod-5.2.1.1/.cabal-sandbox/bin/ghc-mod'
    'stylishHaskellPath': '/home/athan/lib/stylish-haskell-0.5.11.0/.cabal-sandbox/bin/stylish-haskell'
  'editor':
    'fontSize': 14
    'showIndentGuide': true
    'showInvisibles': true
    'softWrapAtPreferredLineLength': true
    'invisibles': {}
Run Code Online (Sandbox Code Playgroud)

我已经测试了这些路径,它们是正确的 - 我可以打电话command --help等.

我目前也在运行Linux,而不是Mac,所以我不得不添加一些键映射:

athan@THETA ~> cat ~/.atom/keymap.cson
'.workspace':
  'ctrl-alt-o': 'ide-haskell:toggle-output'
'.editor':
  'ctrl-alt-s': 'ide-haskell:prettify-file'
Run Code Online (Sandbox Code Playgroud)

这些注册很好,并且在ide-haskell的包设置中可见.但是,发出击键不会做任何事情(分别用于打开文件和另存为).

我最有可能搞砸了哪里?我完成ghc-mod安装之前安装了ide-haskell ,但这并不重要......链接是正确的.如果有人可以帮忙解决这个问题,我会欣喜若狂:)

ide haskell atom-editor ghc-mod

4
推荐指数
1
解决办法
3764
查看次数

为什么ghci不使用相对路径?

如果我的项目结构如下:

project/
  src/
    Foo.hs
    Bar.hs
Run Code Online (Sandbox Code Playgroud)

使用文件Foo.hs:

module Foo where  

foo :: String
foo = "foo"
Run Code Online (Sandbox Code Playgroud)

和Bar.hs:

module Bar where

import Foo 

bar :: String
bar = foo ++ "bar"
Run Code Online (Sandbox Code Playgroud)

如果我的当前目录是src,并且我输入ghci并运行:l Bar.hs,我得到预期的输出:

[1 of 2] Compiling Foo              ( Foo.hs, interpreted )
[2 of 2] Compiling Bar              ( Bar.hs, interpreted )
Ok, modules loaded: Bar, Foo.
Run Code Online (Sandbox Code Playgroud)

但是,如果我移动到project目录(这是我宁愿留下并运行vim/ghci /等),并尝试:l src/Bar.hs,我得到:

src/Bar.hs:3:8:
    Could not find module ‘Foo’
    Use -v to see a list of the files …
Run Code Online (Sandbox Code Playgroud)

haskell ghci ghc-mod

3
推荐指数
1
解决办法
150
查看次数

无法安装 GHC-Mod

大家好,我正在尝试为 vscode 安装 ghc-mod,但我遇到了这个问题:

**$ stack install ghc-mod**
Populated index cache.

Error: While constructing the build plan, the following exceptions were encountered:

In the dependencies for ghc-mod-5.8.0.0:
    Cabal-2.0.1.1 from stack configuration does not match >=1.18 && <1.25 (latest matching version
                  is 1.24.2.0)
    base-4.10.1.0 from stack configuration does not match >=4.6.0.1 && <4.10  (latest matching
                  version is 4.9.1.0)
    mcabal-helper must match <0.8 && >=0.7.3.0, but the stack configuration has no specified version
                 (latest matching version is 0.7.3.0)
    extra-1.6.8 from stack configuration …
Run Code Online (Sandbox Code Playgroud)

haskell ghc-mod haskell-stack

3
推荐指数
1
解决办法
1296
查看次数