问题标签 [haskell-mode]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
261 浏览

emacs - 为 Haskell 开发设置 Emacs 与 Evil-mode

我最近使用 evil 模式从 vim 切换到 emacs,虽然使用 clojure 编码是一种乐趣,但我发现 haskell 环境不能很好地应对 evil-mode ......尤其是“o” , "O" 和 "RET"(在插入模式下)命令在打开新行时会中断当前缩进。例子:

按“o”..

这很烦人,但我在另一个答案中找到了这个解决方案:

也就是说,覆盖每个键,但由于某种原因,“O”等效项不起作用:

另外,它如何对 RET 键做同样的事情?

0 投票
1 回答
564 浏览

haskell - Haskell 模式“找不到模块”

我正在关注 Haskell( Haskeroids ) 中的 Asteroids 教程,但我的子模块有问题。基本上,我的文件夹结构是这样的:

Geometry.hs 文件有

而 Transform.hs 文件有

出于某种原因,ghc 似乎在寻找 Geometry/Haskroids/Geometry.hs。是否有一些设置可以让 ghc 知道在哪里查找文件,以及为 haskell 模式设置它的方法是什么?

编辑:错误消息是:找不到模块 Haskeroids.Geometry。使用 -v 查看搜索到的文件列表

0 投票
0 回答
339 浏览

haskell - 如何配置 Spacemacs 以使用全局安装的 intero?

每当我创建一个新项目并使用 Spacemacs 打开它时,Spacemacs 会一遍又一遍地尝试安装本地 intero,让我等待它完成安装。我可以将全局安装的 intero 用于所有堆栈项目吗?

0 投票
2 回答
1172 浏览

haskell - Emacs haskell intero mode, import could not find module

Edit: this error occurs only when using emacs haskell mode and intero mode (C-c C-l to load into ghci). It works in command line using stack ghc Log.hs LogAnalysis.hs.

I'm learning Haskell through CIS 194 (Spring 2013), and am running into this problem when doing homework 2. The homework folder is very simple:

Some data types are defined in Log.hs, and need to be imported into LogAnalysis.hs, which is the file I need to work on. The first few lines in LogAnalysis.hs are like this:

However, I got error message like this in my emacs using haskell mode with intero:

Same message appears when using 'C-c C-l' to load to ghci within emacs.

But this error doesn't appear when loading LogAnalysis.hs in command line using stack ghci, the message is instead:

So I'm guessing this error has something to do with my emacs' setup of haskell mode and intero mode, but couldn't find any available solution yet.

Thanks for reading this question, your help will be appreciated!

0 投票
0 回答
356 浏览

haskell - Haskell 自动补全以及 Emacs 中的一般信息和文档

我最近开始学习 Haskell 并切换到 Emacs。

我已经安装了haskell-mode

这就是haskell我文件中的部分的.emacs样子

我想知道的是:是否有可能在 emacs 中获得类似自动完成功能的 IDE,其中部分输入函数(用户定义/从导入的包/从基础)向您显示它的类型和一般信息,就像您可以从hoogle搜索中获得的一样?

一个简短的搜索让我找到了这个问题,它有一个 2014 年的最新答案。我不确定自那以后情况是否发生了变化。

我还发现了tagswith hasktagsorfast-tags但我不确定如何应用这些方法从导入的包中获取自动完成建议或获取有关书面函数的文档。

0 投票
1 回答
773 浏览

haskell - Haskell Emacs haskell-mode:运行“Ch f haskell-mode”以获取有关如何设置 Haskell 交互模式的说明

我正在关注https://learnhaskell.blogspot.com/2007/09/lesson-1-hello-world.html中的教程

我按照所有说明进行操作,但是在 emacs 上输入时C-c C-l,我得到了Run 'C-h f haskell-mode' for instruction how to setup a Haskell interaction mode

当我输入它时,我需要一个不是很有帮助的页面。

接下来我该怎么做?除了删除 for 的版本号之外,我完全按照教程中的步骤ghi, emacs进行操作apt

我的.emacs文件如下,和博客里的一模一样。

0 投票
1 回答
210 浏览

debugging - eldoc 模式在获取要在 echo 中显示的信息时挂起 emacs

我对 emacs 相当陌生,并且一直在使用 Haskell 模式并.hs在 emacs 中编写脚本。我注意到它在获取信息以显示在回声栏中时冻结。

禁用global-eldoc-mode似乎可以解决此问题。我相信这不是每个人都面临的问题,我希望能够保持eldoc启用,因为我感谢最近拿起 Haskell 的所有帮助。关于如何解决这个问题的任何想法?

我正在运行emacs 26.2,并且正在运行从 下载的 Haskell 模式melpa.org

我将不胜感激任何意见/帮助,谢谢

0 投票
1 回答
174 浏览

haskell - 如何在 GHCi 中打印类型的构造函数?

使用:tI 可以打印表达式的类型。但是我如何查看该类型的构造函数呢?在 Emacs 的 Haskell 模式下还有一个快捷方式吗?

这似乎是一个基本的东西,但我找不到它。也许我只是在搜索错误的术语...

通常,无需查看文档即可查看打印类型定义的最简单方法是什么。

0 投票
1 回答
371 浏览

haskell - emacs haskell-mode 与 cabal 项目。“`--ghc-option=ferror-spans` 的目标语法无法识别。”

我正在尝试让emacs haskell-modecabal项目一起工作。每当我尝试以交互方式编译或加载文件时,我都会在haskell-process-log

编译(通过(Cc Cc)):

cabal.exe:没有给定目标并且当前目录中没有包。

并且在加载时(通过(Cc Cl)):

cabal.exe:“--ghc-option=-ferror-spans”的无法识别的目标语法


设置:Windows 10、GHC 8.10.2、Cabal 3.2.0.0、emacs 27.1、haskell-mode 20201120.755

我的 emacs 初始化文件有以下内容:

使用一个简单的 Haskell 项目,通过运行创建cabal init

即带有Main.hs

my-project.cabal

如果我尝试通过编译,C-c C-c我会在haskell-process-log缓冲区中得到以下内容:

cabal.exe:没有给定目标并且当前目录中没有包。 对项目中的所有包使用目标“全部”,或按名称或位置
指定包或组件。 有关目标选项
的更多详细信息,请参阅“cabal build --help” 。

如果我尝试通过C-c C-lhaskell 进程加载,则会立即死亡,提示我重新启动并且 haskell-process-log 显示:

cabal.exe:“--ghc-option=-ferror-spans”的目标语法无法识别。

在我的初始化文件自定义变量中使用'(haskell-process-log t)'(haskell-process-show-debug-tips t)设置,这将更改为:

在处理单独的 haskell 文件时,在 emacs 中一切正常,即不在 cabal 项目中。

通过命令行编译和cabal repl在 cabal 项目中也可以正常工作。

我一直在搜索文档并在谷歌上搜索了整整一天半。任何帮助,将不胜感激。

0 投票
1 回答
164 浏览

shell - cabal 如何计算出它所在的目录并寻找目标?

我在 emacs haskell-mode on 中遇到了一个奇怪的错误。当 emacs 通过以下方式调用 cabal 进程时:

构建失败,就好像cabal 在错误的目录中一样:

但附加pwdls命令即:

显示它在正确的目录中:

将命令更改为:

工作正常,奇怪的是,也是如此:

这是在 Windows 10 上发生的,无论我在 emacs 中将什么设置为默认 shell(cygwin、git bash、cmd 等)(即shell-file-name在上面的 elisp 表达式中)。

同时,如果我在 emacs 之外加载每个 shell/终端,或者如果我降级到 cabal 2.4,它构建得很好,问题就消失了。

试图在 Ubuntu 20.04(带有 cabal 2.4 和 3.2)上复制该问题但失败了,所以我的猜测是这是特定于 Windows 的,并且与 2.4 相比,cabal 3.2 的一些新行为。

谁能解释这种奇怪的行为?


设置:Windows 10、GHC 8.10.2、Cabal 3.2.0.0、emacs 27.1、haskell-mode 20201120.755

有关更多详细信息和我尝试过的所有内容,请参阅以前的(不太具体的)问题:

emacs haskell-mode 与 cabal 项目。“`--ghc-option=ferror-spans` 的目标语法无法识别。”

https://emacs.stackexchange.com/questions/63078/bizarre-behaviour-using-call-process-cabal-fails-as-if-it-is-in-wrong-directo