带有沙盒的haskell模式
我尝试了以下方法:带有沙盒的haskell模式,haskell,emacs,haskell-mode,Haskell,Emacs,Haskell Mode,我尝试了以下方法: cabal sandbox init 然后制作以下阴谋集团文件 -- Initial hsource.cabal generated by cabal init. For further -- documentation, see http://haskell.org/cabal/users-guide/ name: hsource version: 0.1.0.0 -- synopsis:
cabal sandbox init
然后制作以下阴谋集团文件
-- Initial hsource.cabal generated by cabal init. For further
-- documentation, see http://haskell.org/cabal/users-guide/
name: hsource
version: 0.1.0.0
-- synopsis:
-- description:
-- license:
license-file: LICENSE
author: abc
maintainer: abc
-- copyright:
-- category:
build-type: Simple
-- extra-source-files:
cabal-version: >=1.10
executable hsource
main-is: main.hs
other-modules:
-- other-extensions:
build-depends: base >=4.7 && <4.8, csv
hs-source-dirs: src
default-language: Haskell2010
现在,当我尝试导入Text.CSV时,出现以下错误:
Util/RandomTree.hs:7:8-15: Could not find module ‘Text.CSV’ …
Use -v to see a list of the files searched for.
Compilation failed.
因此,我的问题是,如果在haskell模式下不支持沙盒,或者我是否遗漏了使它们工作的一些步骤?请确保:
(add-hook 'haskell-mode-hook 'interactive-haskell-mode)
在emacs init文件中
haskell模式支持不同的模式。你需要一个使用阴谋集团的人
要了解当前应用的流程类型,请使用M-x descripe variable
并输入haskell流程类型
我认为haskell模式的文档已经过时了;因为,查看源代码,默认值是auto
,如果能够找到.cabal沙盒目录,它将使用cabal repl
。否则,它将使用ghci
因此,如果您的haskell进程类型
设置为ghci
或auto
,并且无法找到您的阴谋沙箱,您将看到您发布的错误。如果当前设置为ghci
,则通过添加以下内容将haskell流程类型更改为cabal repl
:
(custom-set-variables
'(haskell-process-type 'cabal-repl))
添加到emacs init文件并重新启动emacs进程
此外,通过打开命令行,导航到包含.cabal文件的目录并输入cabal repl
,您始终可以确认问题特定于emacs。如果可以,那么您的阴谋集团设置就可以了。您确定已启用交互式haskell模式挂钩吗?您似乎正在使用SUPER-HASKEL-mode。针对HASKEL模式的github问题可能会有所帮助:我启用了交互式HASKEL模式,并且HASKEL进程类型设置为ghci。有没有关于如何继续查找错误的提示?因此,当我将haskell进程类型设置为cabal repl时,它修复了大多数问题。然而,flycheck仍然在缓冲区中的文本下面加下划线,表示无法找到该文件。有冰吗?如何让flycheck工作?另外,将haskell进程类型设置为“自动”也不起作用。我认为此链接应该有帮助:。
(custom-set-variables
'(haskell-process-type 'cabal-repl))