dante icon indicating copy to clipboard operation
dante copied to clipboard

Crash upon opening .hs file

Open IgorGee opened this issue 4 years ago • 7 comments

init.el

;; Haskell IDE
(use-package haskell-mode)

(use-package dante
  :after haskell-mode
  :commands 'dante-mode
  :init
  (add-hook 'haskell-mode-hook 'flycheck-mode)
  (add-hook 'haskell-mode-hook 'dante-mode))

Messages

Dante: Starting GHCi: nix-shell --pure --run "cabal repl  --builddir=dist/dante"
Problem with GHCi process!

Notes

  • I can run ghci, cabal in my terminal just fine.
  • cabal and ghci were both obtained via nix package manager.
  • This happens on any .hs file.
  • Emacs: v26.3
  • Dante: dante-20200131.1211
  • OS: Ubuntu 19.10
  • Kernel: 5.3.0-40-generic x86_64

HelloWorld.hs

module HelloWorld (hello) where

hello :: String
hello = "Hello, World!"

Dante Output

This is the buffer associated with the GHCi session. This buffer
is normally hidden, but the GHCi process ended.

WHAT TO DO NEXT

Verify that the GHCi REPL can be loaded manually, then try to
customize (probably file-locally or directory-locally)
`dante-project-root' and/or `dante-repl-command-line'.  If you
fixed the problem, just kill this buffer, Dante will make a fresh
one and attempt to restart GHCi automatically.
If you leave this buffer around Dante will not attempt to restart
GHCi.  You can always run `dante-restart' to make it try again.

EXTRA TROUBLESHOOTING INFO

Process state change: exited abnormally with code 127

default-directory "/home/igor/snap/exercism/current/exercism/haskell/hello-world/"
dante-command-line ("nix-shell" "--pure" "--run" "cabal repl  --builddir=dist/dante")
dante-state dead
dante-queue (#[257 "r\302\301!\203\0\302\301!q\210\212\301b\210\300!*\207" [#[257 "\211\204\0\300?\205\0\306\307\310\"\304\"\211\303\205\0\211\211\203(\0\307\311\"\301!\262\202i\0\302\211\300\211\312\313\305!\304#\314\315\211\305\315\316%\300\203G\0\317\202H\0\320\321\322\323\324\325\326\300\301\304\305&\327\"\330\331%\"\262\262\262\262\262\262\262\262\207" [nil #[257 "\302\303p!!\301\304\305\306\307\310\311\312\313\300
\"\314\"\315\316%\"!\"\207" [haskell-dante #[128 "\301\302\300#\207" [#s(flycheck-syntax-check #<buffer HelloWorld.hs> haskell-dante nil "~/snap/exercism/current/exercism/haskell/hello-world/") apply flycheck-report-buffer-checker-status] 5 "

(fn &rest ARGS)"] dante-local-name dante-temp-file-name finished -non-nil mapcar make-byte-code 257 "\302\300p\301$\207" vconcat vector [dante-fly-message] 6 "

(fn IT)"] 13 "

(fn MESSAGES)"] 3 nil "/home/igor/snap/exercism/current/exercism/haskell/hello-world/src/HelloWorld.hs" "/tmp/dantel33glL.hs" s-equals\? buffer-local-value dante-loaded-file dante-load-message puthash dante-local-name write-region nil 0 ":set -fbyte-code" ":set -fobject-code" dante-async-call make-byte-code 257 "p\211\304q\306\305\203
\0\307\202\0\310\300\203\0\311\202\0\312\313\303!Q!\314\312\315\316\317\320\321\322\301\302#\323\"\324\325%#\262\262\262\207" vconcat vector [dante-async-write ":r" ":l " "*" "" dante-local-name dante-load-loop nil make-byte-code 257 "\211\211G\305U\203\0\211A\262\242\202\0\306\307\310GD\"\211A\262\242@\301\211\266\203\302q\300!\262\262\207" vconcat vector [dante-loaded-file dante-load-message 3 signal wrong-number-of-arguments nil] 7 "

(fn V19)"] 16 "

(fn V14)" dante-interpreted dante-temp-epoch dante-original-buffer-map] 23 "

(fn V6)"] #<marker at 1 in HelloWorld.hs> marker-buffer] 3 "

(fn BUFFER)"])
dante-loaded-file "<DANTE:NO-FILE-LOADED>"
dante-load-message nil
lcr-process-callback #[257 "\303\304\305\300#\210r\306\302!\203\0\306\302!q\210\212\302b\210\301!*\207" [#<buffer *dante:hello-world::~/snap/exercism/current/exercism/haskell/hello-world/*> #[257 "\302\303\"\210\300\304\305\306#!\210\307\301!\207" [#[257 "\300\242P\300\240\301\304\300\242\"\240\305\302\242!\262\262\207" [("/tmp/nix-shell-5127-0/rc: line 1: cabal: command not found
") (nil) (#[0 "\303\242?\211\203\0\305\306\307\310\311\312\302\303\304#\313\"\314\315%!\202,\0\316\302\242\317\320\224SO!\301q\300!\262\262\207" [#[257 "\300\301!\207" [dante-set-state running] 3 "

(fn START-MESSAGES)"] #<buffer HelloWorld.hs> ("/tmp/nix-shell-5127-0/rc: line 1: cabal: command not found
") (nil) #6 dante-async-read make-byte-code 257 "\300\242P\300\240\301\304\300\242\"\240\305\302\242!\262\262\207" vconcat vector [dante-ghci-prompt string-match lcr-yield] 7 "

(fn V65)" s-trim-right 0 1] 10]) dante-ghci-prompt string-match lcr-yield] 7 "

(fn V65)"] #<buffer *dante:hello-world::~/snap/exercism/current/exercism/haskell/hello-world/*> dante-debug inputs s-replace "
" "" dante-schedule-next] 6 "

(fn INPUT)"] #<marker at 1 in *dante:hello-world::~/snap/exercism/current/exercism/haskell/hello-world/*> lcr-set-local lcr-process-callback nil marker-buffer] 5 "

(fn INPUT)"]

IgorGee avatar Mar 01 '20 04:03 IgorGee

Was also able to reproduce on the develop branch of spacemacs

IgorGee avatar Mar 03 '20 22:03 IgorGee

relatedly (?) I just tried out Dante for the first time, and immediately it filled my ~32GB ram and crashed my computer. After a reboot, that's no longer happening, but none of its features work, eg on C-c . or M-.: No definitions found for: "/tmp/dante....

I followed stock instructions, i'm on debian with an up-to-date os and up-to-date emacs, and intero, this project's upstream, has always worked flawlessly for me. I'm excited for Dante's potential and plan on trying again in the future.

freckletonj avatar Mar 09 '20 21:03 freckletonj

Did you try running ghci with the exact same command line as dante? (Check:

dante-command-line ("nix-shell" "--pure" "--run" "cabal repl  --builddir=dist/dante")

jyp avatar Apr 16 '20 12:04 jyp

I'm not sure I know what the exact command line dante is using.

I don't think I understand what you're asking, but I was able to run ghci within the emacs shell only after installing this package: exec-path-from-shell

IgorGee avatar Apr 24 '20 13:04 IgorGee

Check the value of dante-command-line and try to run the same command manually.

jyp avatar Sep 01 '20 07:09 jyp

I use spacemacs + dante on NixOS.

The command dante-command-line ("nix-shell" "--pure" "--run" "cabal repl --builddir=dist/dante") is setting the variable dante uses to invoke ghci as a subprocess. So you need to go to the root directory of your project and run nix-shell --pure --run 'cabal repl --builddir=dist/dante' from the command line. If that fails then it is not a dante-specific issue. All dante is doing is invoking that command to create a sub-process with which to communicate to ghci, so if you can't get that command working then you won't be able to get dante to work.

I'm not familiar with exec-path-from-shell, it sounds like direnv to me, but if you have ghci globally installed then running ghci from within eshell won't prove anything about running ghci from within nix-shell like you are trying to do with dante. You can try to open eshell and run nix-shell from there, but in my experience eshell can get wonky when invoking nix-shell

doyougnu avatar Sep 05 '20 19:09 doyougnu

What fixes this for me is

(setq dante-repl-command-line '("nix-shell" "--run" "cabal repl"))

because nix-shell --pure doesn't necessarily contain cabal(-install) if you don't add it explicitly. I do have cabal installed for my user so I want it to propagate to nix-shells, hence removing --pure fixes it. Also it seems to work just fine with v2-repl which is now the default one.

sorki avatar Mar 26 '21 11:03 sorki