haskell-mode 企图调用REPL失败,Emacs挂死?

ELPA上安装的haskell-mode

打开hs文件,执行haskell-process-load-file,挂死,mini-buffer上显示:

The Haskell process `haskell' has died. Restart? (y, n, l: show process log)

输入l后,打开haskell-process-log:

("Starting inferior GHCi process ghci ..." "haskell" nil "ghci" "-ferror-spans")
-> Prelude.putStrLn ""
   :set -v1
   :set +c
-> :set prompt "\4"
-> :set prompt2 "λ| "
<- GHCi, version 8.6.3: http://www.haskell.org/ghc/  :? for help
   
<- Prelude> 
   Prelude> Prelude> Prelude> Leaving GHCi.
   
-> :cd e:/work-haskell/
Event: "finished
"

Backtrace:

Debugger entered--Lisp error: (file-error "Writing to process" "Invalid argument" #<process haskell>)
  process-send-string(#<process haskell> ":cd e:/work-haskell/\n")
  haskell-process-send-string(((name . "haskell") (current-response-cursor . 0) (current-response . "") (command-queue #s(haskell-command :state (((name . "haskell") (next-error-region #<marker at 1 in *haskell*> . #<marker (moves after insertion) at 300 in *haskell*>) (next-error-locus) (interactive-buffer . #<buffer *haskell*>) (current-dir . "e:/work-haskell/") (cabal-checksum) (cabal-dir . "e:/work-haskell/") (process . #1)) #1 "load \"e:/work-haskell/test.hs\"" nil #<buffer test.hs>) :go #f(compiled-function (state) #<bytecode 0x1a50455>) :live #f(compiled-function (state buffer) #<bytecode 0x1a50469>) :complete #f(compiled-function (state response) #<bytecode 0x1a50475>))) (inferior-process . #<process haskell>) (is-restarting) (current-command . #s(haskell-command :state (((name . "haskell") (next-error-region #<marker at 1 in *haskell*> . #<marker (moves after insertion) at 300 in *haskell*>) (next-error-locus) (interactive-buffer . #<buffer *haskell*>) (current-dir . "e:/work-haskell/") (cabal-checksum) (cabal-dir . "e:/work-haskell/") (process . #1)) #1 "e:/work-haskell/") :go #f(compiled-function (state) #<bytecode 0xdc6609>) :live nil :complete #f(compiled-function (state _) #<bytecode 0xdc6621>))) (suggested-imported) (sent-stdin) (evaluating) (session (name . "haskell") (next-error-region #<marker at 1 in *haskell*> . #<marker (moves after insertion) at 300 in *haskell*>) (next-error-locus) (interactive-buffer . #<buffer *haskell*>) (current-dir . "e:/work-haskell/") (cabal-checksum) (cabal-dir . "e:/work-haskell/") (process . #1))) ":cd e:/work-haskell/")
  #f(compiled-function (state) #<bytecode 0xdc6609>)((((name . "haskell") (next-error-region #<marker at 1 in *haskell*> . #<marker (moves after insertion) at 300 in *haskell*>) (next-error-locus) (interactive-buffer . #<buffer *haskell*>) (current-dir . "e:/work-haskell/") (cabal-checksum) (cabal-dir . "e:/work-haskell/") (process (name . "haskell") (current-response-cursor . 0) (current-response . "") (command-queue #s(haskell-command :state (#2 ((name . "haskell") (current-response-cursor . 0) (current-response . "") #4 (inferior-process . #<process haskell>) (is-restarting) (current-command . #s(haskell-command :state #1 :go #f(compiled-function (state) #<bytecode 0xdc6609>) :live nil :complete #f(compiled-function (state _) #<bytecode 0xdc6621>))) (suggested-imported) (sent-stdin) (evaluating) (session . #2)) "load \"e:/work-haskell/test.hs\"" nil #<buffer test.hs>) :go #f(compiled-function (state) #<bytecode 0x1a50455>) :live #f(compiled-function (state buffer) #<bytecode 0x1a50469>) :complete #f(compiled-function (state response) #<bytecode 0x1a50475>))) (inferior-process . #<process haskell>) (is-restarting) (current-command . #s(haskell-command :state #1 :go #f(compiled-function (state) #<bytecode 0xdc6609>) :live nil :complete #f(compiled-function (state _) #<bytecode 0xdc6621>))) (suggested-imported) (sent-stdin) (evaluating) (session . #2))) ((name . "haskell") (current-response-cursor . 0) (current-response . "") (command-queue #s(haskell-command :state (((name . "haskell") (next-error-region #<marker at 1 in *haskell*> . #<marker (moves after insertion) at 300 in *haskell*>) (next-error-locus) (interactive-buffer . #<buffer *haskell*>) (current-dir . "e:/work-haskell/") (cabal-checksum) (cabal-dir . "e:/work-haskell/") (process . #2)) #2 "load \"e:/work-haskell/test.hs\"" nil #<buffer test.hs>) :go #f(compiled-function (state) #<bytecode 0x1a50455>) :live #f(compiled-function (state buffer) #<bytecode 0x1a50469>) :complete #f(compiled-function (state response) #<bytecode 0x1a50475>))) (inferior-process . #<process haskell>) (is-restarting) (current-command . #s(haskell-command :state #1 :go #f(compiled-function (state) #<bytecode 0xdc6609>) :live nil :complete #f(compiled-function (state _) #<bytecode 0xdc6621>))) (suggested-imported) (sent-stdin) (evaluating) (session (name . "haskell") (next-error-region #<marker at 1 in *haskell*> . #<marker (moves after insertion) at 300 in *haskell*>) (next-error-locus) (interactive-buffer . #<buffer *haskell*>) (current-dir . "e:/work-haskell/") (cabal-checksum) (cabal-dir . "e:/work-haskell/") (process . #2))) "e:/work-haskell/"))
  haskell-command-exec-go(#s(haskell-command :state (((name . "haskell") (next-error-region #<marker at 1 in *haskell*> . #<marker (moves after insertion) at 300 in *haskell*>) (next-error-locus) (interactive-buffer . #<buffer *haskell*>) (current-dir . "e:/work-haskell/") (cabal-checksum) (cabal-dir . "e:/work-haskell/") (process (name . "haskell") (current-response-cursor . 0) (current-response . "") (command-queue #s(haskell-command :state (#3 ((name . "haskell") (current-response-cursor . 0) (current-response . "") #5 (inferior-process . #<process haskell>) (is-restarting) (current-command . #1) (suggested-imported) (sent-stdin) (evaluating) (session . #3)) "load \"e:/work-haskell/test.hs\"" nil #<buffer test.hs>) :go #f(compiled-function (state) #<bytecode 0x1a50455>) :live #f(compiled-function (state buffer) #<bytecode 0x1a50469>) :complete #f(compiled-function (state response) #<bytecode 0x1a50475>))) (inferior-process . #<process haskell>) (is-restarting) (current-command . #1) (suggested-imported) (sent-stdin) (evaluating) (session . #3))) ((name . "haskell") (current-response-cursor . 0) (current-response . "") (command-queue #s(haskell-command :state (((name . "haskell") (next-error-region #<marker at 1 in *haskell*> . #<marker (moves after insertion) at 300 in *haskell*>) (next-error-locus) (interactive-buffer . #<buffer *haskell*>) (current-dir . "e:/work-haskell/") (cabal-checksum) (cabal-dir . "e:/work-haskell/") (process . #3)) #3 "load \"e:/work-haskell/test.hs\"" nil #<buffer test.hs>) :go #f(compiled-function (state) #<bytecode 0x1a50455>) :live #f(compiled-function (state buffer) #<bytecode 0x1a50469>) :complete #f(compiled-function (state response) #<bytecode 0x1a50475>))) (inferior-process . #<process haskell>) (is-restarting) (current-command . #1) (suggested-imported) (sent-stdin) (evaluating) (session (name . "haskell") (next-error-region #<marker at 1 in *haskell*> . #<marker (moves after insertion) at 300 in *haskell*>) (next-error-locus) (interactive-buffer . #<buffer *haskell*>) (current-dir . "e:/work-haskell/") (cabal-checksum) (cabal-dir . "e:/work-haskell/") (process . #3))) "e:/work-haskell/") :go #f(compiled-function (state) #<bytecode 0xdc6609>) :live nil :complete #f(compiled-function (state _) #<bytecode 0xdc6621>)))
  haskell-process-trigger-queue(((name . "haskell") (current-response-cursor . 0) (current-response . "") (command-queue #s(haskell-command :state (((name . "haskell") (next-error-region #<marker at 1 in *haskell*> . #<marker (moves after insertion) at 300 in *haskell*>) (next-error-locus) (interactive-buffer . #<buffer *haskell*>) (current-dir . "e:/work-haskell/") (cabal-checksum) (cabal-dir . "e:/work-haskell/") (process . #1)) #1 "load \"e:/work-haskell/test.hs\"" nil #<buffer test.hs>) :go #f(compiled-function (state) #<bytecode 0x1a50455>) :live #f(compiled-function (state buffer) #<bytecode 0x1a50469>) :complete #f(compiled-function (state response) #<bytecode 0x1a50475>))) (inferior-process . #<process haskell>) (is-restarting) (current-command . #s(haskell-command :state (((name . "haskell") (next-error-region #<marker at 1 in *haskell*> . #<marker (moves after insertion) at 300 in *haskell*>) (next-error-locus) (interactive-buffer . #<buffer *haskell*>) (current-dir . "e:/work-haskell/") (cabal-checksum) (cabal-dir . "e:/work-haskell/") (process . #1)) #1 "e:/work-haskell/") :go #f(compiled-function (state) #<bytecode 0xdc6609>) :live nil :complete #f(compiled-function (state _) #<bytecode 0xdc6621>))) (suggested-imported) (sent-stdin) (evaluating) (session (name . "haskell") (next-error-region #<marker at 1 in *haskell*> . #<marker (moves after insertion) at 300 in *haskell*>) (next-error-locus) (interactive-buffer . #<buffer *haskell*>) (current-dir . "e:/work-haskell/") (cabal-checksum) (cabal-dir . "e:/work-haskell/") (process . #1))))
  haskell-process-collect(((name . "haskell") (next-error-region #<marker at 1 in *haskell*> . #<marker (moves after insertion) at 300 in *haskell*>) (next-error-locus) (interactive-buffer . #<buffer *haskell*>) (current-dir . "e:/work-haskell/") (cabal-checksum) (cabal-dir . "e:/work-haskell/") (process (name . "haskell") (current-response-cursor . 0) (current-response . "") (command-queue #s(haskell-command :state (#1 ((name . "haskell") (current-response-cursor . 0) (current-response . "") #3 (inferior-process . #<process haskell>) (is-restarting) (current-command . #s(haskell-command :state (#1 #6 "e:/work-haskell/") :go #f(compiled-function (state) #<bytecode 0xdc6609>) :live nil :complete #f(compiled-function (state _) #<bytecode 0xdc6621>))) (suggested-imported) (sent-stdin) (evaluating) (session . #1)) "load \"e:/work-haskell/test.hs\"" nil #<buffer test.hs>) :go #f(compiled-function (state) #<bytecode 0x1a50455>) :live #f(compiled-function (state buffer) #<bytecode 0x1a50469>) :complete #f(compiled-function (state response) #<bytecode 0x1a50475>))) (inferior-process . #<process haskell>) (is-restarting) (current-command . #s(haskell-command :state (#1 ((name . "haskell") (current-response-cursor . 0) (current-response . "") (command-queue #s(haskell-command :state (#1 #6 "load \"e:/work-haskell/test.hs\"" nil #<buffer test.hs>) :go #f(compiled-function (state) #<bytecode 0x1a50455>) :live #f(compiled-function (state buffer) #<bytecode 0x1a50469>) :complete #f(compiled-function (state response) #<bytecode 0x1a50475>))) (inferior-process . #<process haskell>) (is-restarting) #3 (suggested-imported) (sent-stdin) (evaluating) (session . #1)) "e:/work-haskell/") :go #f(compiled-function (state) #<bytecode 0xdc6609>) :live nil :complete #f(compiled-function (state _) #<bytecode 0xdc6621>))) (suggested-imported) (sent-stdin) (evaluating) (session . #1))) "Prelude> \nPrelude> Prelude> Prelude> \004Leaving GHCi.\n" ((name . "haskell") (current-response-cursor . 0) (current-response . "") (command-queue #s(haskell-command :state (((name . "haskell") (next-error-region #<marker at 1 in *haskell*> . #<marker (moves after insertion) at 300 in *haskell*>) (next-error-locus) (interactive-buffer . #<buffer *haskell*>) (current-dir . "e:/work-haskell/") (cabal-checksum) (cabal-dir . "e:/work-haskell/") (process . #1)) #1 "load \"e:/work-haskell/test.hs\"" nil #<buffer test.hs>) :go #f(compiled-function (state) #<bytecode 0x1a50455>) :live #f(compiled-function (state buffer) #<bytecode 0x1a50469>) :complete #f(compiled-function (state response) #<bytecode 0x1a50475>))) (inferior-process . #<process haskell>) (is-restarting) (current-command . #s(haskell-command :state (((name . "haskell") (next-error-region #<marker at 1 in *haskell*> . #<marker (moves after insertion) at 300 in *haskell*>) (next-error-locus) (interactive-buffer . #<buffer *haskell*>) (current-dir . "e:/work-haskell/") (cabal-checksum) (cabal-dir . "e:/work-haskell/") (process . #1)) #1 "e:/work-haskell/") :go #f(compiled-function (state) #<bytecode 0xdc6609>) :live nil :complete #f(compiled-function (state _) #<bytecode 0xdc6621>))) (suggested-imported) (sent-stdin) (evaluating) (session (name . "haskell") (next-error-region #<marker at 1 in *haskell*> . #<marker (moves after insertion) at 300 in *haskell*>) (next-error-locus) (interactive-buffer . #<buffer *haskell*>) (current-dir . "e:/work-haskell/") (cabal-checksum) (cabal-dir . "e:/work-haskell/") (process . #1))))
  haskell-process-filter(#<process haskell> "Prelude> \nPrelude> Prelude> Prelude> \004Leaving GHCi.\n")

haskell-process-type 使用ghci和cabal-repl结果都一样。。。

有坛友遇到过类似的问题吗?

Windows 7, GHCi 8.6.3, Emacs 26.1 (Path都加了)

我也遇到了同样的问题,最后找到了解决方案。在配置文件中添加(set-language-environment ‘utf-8)

2 个赞

多谢,在github上看到你回复了。前段时间没上网,回晚了 :blush: