Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Haskell process command errored with: (error "Unexpected response from haskell process.") #1496

Closed
Abhiroop opened this issue Apr 5, 2017 · 12 comments · Fixed by #1605
Closed

Comments

@Abhiroop
Copy link

Abhiroop commented Apr 5, 2017

A Haskell project which builds fine with stack build runs into this issue.

Unexpected response from haskell process.
Haskell process command errored with: (error "Unexpected response from haskell process.")

No helpful error messages to debug too.

@identicalsnowflake
Copy link

identicalsnowflake commented Aug 30, 2017

I just upgraded to GHC 8.2.1 and suddenly I'm getting this, too. My project builds fine (no stack involved), but emacs mode is broken - C-c C-l gives the error you posted.

EDIT: Downgrading to GHC 8.0.2 causes this error to go away.

@gracjan
Copy link
Contributor

gracjan commented Aug 30, 2017

This is related: #1168

@Abhiroop
Copy link
Author

The issue was solved for me when I :set -fobject-code in GHCi. This issue can be closed now, if its solved for @identicalsnowflake

@identicalsnowflake
Copy link

Where are you setting this? I tried entering :set -fobject-code in ghci directly as well as putting it in my .ghci file in my home directory, but I still get the unexpected response error.

@Abhiroop
Copy link
Author

Abhiroop commented Sep 1, 2017

This error message might be a common message for different class of errors(I am not sure about this).
For me I faced it while compiling https://github.com/typelead/eta
Setting object code in GHCi worked for me. And I was on GHC 7.10.

@identicalsnowflake
Copy link

Hmm. In my case I don't think it's a package: I get it even on the default "Hello world" file generated by cabal init.

@peti
Copy link
Contributor

peti commented Oct 17, 2017

This is a duplicate of #1553.

@nrolland
Copy link

nrolland commented Jun 3, 2018

I am confronted to this message. How can we debug that to get more information on what's failing ?

@Abhiroop
Copy link
Author

Abhiroop commented Jun 3, 2018

@nrolland This seems like a common catch all error clause whose occurrence entirely depends on the code that you are trying to load. Like mentioned above my issue was solved by setting :set -fobject-code, but it is not necessary that the same will work with you.

I faced the same warning when I was trying to load a program with unlifted types. So you would have to produce a snippet of the program you are trying to load to debug it.

@nrolland
Copy link

nrolland commented Jun 3, 2018

@Abhiroop yeah, and since it's generic I imagined there was some "debug" facility to get more info to activate somewhere.

There is an haskell-process-log emacs variable which creates a buffer but that seems to be OK, my module is loaded.

How did you come up with your idea of setting :set -fobject-code ?

@nrolland
Copy link

nrolland commented Jun 3, 2018

For potential future references, there seems to be a bunch of heuristics in haskell-load.el in haskell-process-load-complete on how to interpret the response (found by C-h f haskell-process-load-file , reading the source, and repeating the process )

Replacing the function haskell-process-consume which does the matching to

(defun haskell-process-consume (process regex)
  "Consume a regex from the response and move the cursor along if succeed."
  (progn
    (haskell-process-log (format "process: %S\n" (haskell-process-response process)))
    (haskell-process-log (format "regex: %s\n" regex))
  (when (string-match regex
                      (haskell-process-response process)
                      (haskell-process-response-cursor process))
    (haskell-process-set-response-cursor process (match-end 0))
    t)))

and eval-defun this, one can then see in *haskell-process-log*, after loading a file

-> :load "/Users/nrolland/Sync/mactoastyClones/xquant2/content/notes/typerole/src/Examples.hs"
<- [1 of 1] Compiling Examples ( /Users/nrolland/Sync/mactoastyClones/xquant2/content/notes/typerole/src/Examples.hs, interpreted )
Ok, one module loaded.
Collecting type info for 1 module(s) ...

process: "[1 of 1] Compiling Examples ( /Users/nrolland/Sync/mactoastyClones/xquant2/content/notes/typerole/src/Examples.hs, interpreted )
Ok, one module loaded.
Collecting type info for 1 module(s) ...
�"

regex: [[ ]([0-9]+) of ([0-9]+)] Compiling ([^ ]+)[ ]+( ([^ ]+), ([^ ]+) )[^][
]+

process: "[1 of 1] Compiling Examples ( /Users/nrolland/Sync/mactoastyClones/xquant2/content/notes/typerole/src/Examples.hs, interpreted )
Ok, one module loaded.
Collecting type info for 1 module(s) ...
�"

regex: [[ ]([0-9]+) of ([0-9]+)] Compiling ([^ ]+)[ ]+( ([^ ]+), ([^ ]+) )[^][
]+

process: "[1 of 1] Compiling Examples ( /Users/nrolland/Sync/mactoastyClones/xquant2/content/notes/typerole/src/Examples.hs, interpreted )
Ok, one module loaded.
Collecting type info for 1 module(s) ...
�"

regex: [[ ]([0-9]+) of ([0-9]+)] Compiling [TH] ([^ ]+)[ ]+( ([^ ]+), ([^ ]+) )[^][
]+

process: "[1 of 1] Compiling Examples ( /Users/nrolland/Sync/mactoastyClones/xquant2/content/notes/typerole/src/Examples.hs, interpreted )
Ok, one module loaded.
Collecting type info for 1 module(s) ...
�"

regex: Loading package ([^ ]+) ... linking ... done.

process: "[1 of 1] Compiling Examples ( /Users/nrolland/Sync/mactoastyClones/xquant2/content/notes/typerole/src/Examples.hs, interpreted )
Ok, one module loaded.
Collecting type info for 1 module(s) ...
�"

regex: ^Preprocessing executables for (.+?)...

process: "[1 of 1] Compiling Examples ( /Users/nrolland/Sync/mactoastyClones/xquant2/content/notes/typerole/src/Examples.hs, interpreted )
Ok, one module loaded.
Collecting type info for 1 module(s) ...
�"

regex: Linking (.+?) ...

process: "[1 of 1] Compiling Examples ( /Users/nrolland/Sync/mactoastyClones/xquant2/content/notes/typerole/src/Examples.hs, interpreted )
Ok, one module loaded.
Collecting type info for 1 module(s) ...
�"

regex:
Building (.+?)...

process: "[1 of 1] Compiling Examples ( /Users/nrolland/Sync/mactoastyClones/xquant2/content/notes/typerole/src/Examples.hs, interpreted )
Ok, one module loaded.
Collecting type info for 1 module(s) ...
�"

regex: Ok, (?:[0-9]+) modules? loaded.$

process: "[1 of 1] Compiling Examples ( /Users/nrolland/Sync/mactoastyClones/xquant2/content/notes/typerole/src/Examples.hs, interpreted )
Ok, one module loaded.
Collecting type info for 1 module(s) ...
�"

regex: Failed, (?:[0-9]+) modules? loaded.$

process: "[1 of 1] Compiling Examples ( /Users/nrolland/Sync/mactoastyClones/xquant2/content/notes/typerole/src/Examples.hs, interpreted )
Ok, one module loaded.
Collecting type info for 1 module(s) ...
�"

regex: Ok, modules loaded: (.+).$

process: "[1 of 1] Compiling Examples ( /Users/nrolland/Sync/mactoastyClones/xquant2/content/notes/typerole/src/Examples.hs, interpreted )
Ok, one module loaded.
Collecting type info for 1 module(s) ...
�"

regex: Failed, modules loaded: (.+).$

This was probably intended to match

process: "[1 of 1] Compiling Examples ( /Users/nrolland/Sync/mactoastyClones/xquant2/content/notes/typerole/src/Examples.hs, interpreted )
Ok, one module loaded.
Collecting type info for 1 module(s) ...
�"

regex: Ok, (?:[0-9]+) modules? loaded.$

Notice "one" in the response VS "1" in the match

@GeorgeCo
Copy link

GeorgeCo commented Aug 12, 2018

I'm seeing this issue on ghc 8.4.3 with the latest version of haskell-mode, without stack. haskell-process-log shows:

:set prompt2 "λ| "
...
�Some flags have not been recognized: prompt2

The issue seems to be that the code is using ":set prompt2" instead of :set prompt-cont as adamse points out in #1569. This can be verified in ghci:

λ> :set prompt2 "λ| "
Some flags have not been recognized: prompt2, λ|
λ> :set prompt-cont "λ| "
λ>

I changed the code to set prompt-cont rather than prompt2 which got rid of the error above but does not seem to fix the reported issue although the error message seems irrelevant as the code does get loaded (which may even have been true before I made that change in the .el files on my machine). This issue seems like it is being fixed in #1605

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants