Skip to content

haskell-interactive-type-show-for-ambiguous is not respected #1889

@rvs314

Description

@rvs314

Hi, I'm used to having non-Showable objects printed as their types, as the variable haskell-interactive-type-show-for-ambiguous is documented to do, but it's currently not working. Some debugging shows that the haskell process is not giving exactly the same error message as what is expected. Here's the full backtrace:

*Backtrace*
Debugger entered--entering a function:
* haskell-interactive-mode-trigger-compile-error((((name . "haskell") (next-error-region #<marker at 338 in *haskell*> . #<marker (moves after insertion) at 338 in *haskell*>) (next-error-locus) (interactive-buffer . #<buffer *haskell*>) (current-dir . "/home/rvs314/.tmp/") (cabal-checksum) (cabal-dir . "/home/rvs314/.tmp/") (process (name . "haskell") (current-response-cursor . 0) (current-response . "<interactive>:19:1-4: error: [GHC-39999]\n    • No instance for ‘Show (() -> String)’\n        arising from a use of ‘print’\n        (maybe you haven't applied a function to enough arguments?)\n    • In a stmt of an interactive GHCi command: print it\n\n\4") (command-queue) (inferior-process . #<process haskell>) (is-restarting) (current-command . #s(haskell-command :state #1 :go #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_12> :live #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_13> :complete #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_14>)) (suggested-imported) (sent-stdin) (evaluating) (session . #2))) ((name . "haskell") (current-response-cursor . 0) (current-response . "<interactive>:19:1-4: error: [GHC-39999]\n    • No instance for ‘Show (() -> String)’\n        arising from a use of ‘print’\n        (maybe you haven't applied a function to enough arguments?)\n    • In a stmt of an interactive GHCi command: print it\n\n\4") (command-queue) (inferior-process . #<process haskell>) (is-restarting) (current-command . #s(haskell-command :state #1 :go #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_12> :live #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_13> :complete #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_14>)) (suggested-imported) (sent-stdin) (evaluating) (session (name . "haskell") (next-error-region #<marker at 338 in *haskell*> . #<marker (moves after insertion) at 338 in *haskell*>) (next-error-locus) (interactive-buffer . #<buffer *haskell*>) (current-dir . "/home/rvs314/.tmp/") (cabal-checksum) (cabal-dir . "/home/rvs314/.tmp/") (process . #3))) "show" 250) "<interactive>:19:1-4: error: [GHC-39999]\n    • No instance for ‘Show (() -> String)’\n        arising from a use of ‘print’\n        (maybe you haven't applied a function to enough arguments?)\n    • In a stmt of an interactive GHCi command: print it\n\n")
  #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_14>((((name . "haskell") (next-error-region #<marker at 338 in *haskell*> . #<marker (moves after insertion) at 338 in *haskell*>) (next-error-locus) (interactive-buffer . #<buffer *haskell*>) (current-dir . "/home/rvs314/.tmp/") (cabal-checksum) (cabal-dir . "/home/rvs314/.tmp/") (process (name . "haskell") (current-response-cursor . 0) (current-response . "<interactive>:19:1-4: error: [GHC-39999]\n    • No instance for ‘Show (() -> String)’\n        arising from a use of ‘print’\n        (maybe you haven't applied a function to enough arguments?)\n    • In a stmt of an interactive GHCi command: print it\n\n\4") (command-queue) (inferior-process . #<process haskell>) (is-restarting) (current-command . #s(haskell-command :state #1 :go #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_12> :live #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_13> :complete #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_14>)) (suggested-imported) (sent-stdin) (evaluating) (session . #2))) ((name . "haskell") (current-response-cursor . 0) (current-response . "<interactive>:19:1-4: error: [GHC-39999]\n    • No instance for ‘Show (() -> String)’\n        arising from a use of ‘print’\n        (maybe you haven't applied a function to enough arguments?)\n    • In a stmt of an interactive GHCi command: print it\n\n\4") (command-queue) (inferior-process . #<process haskell>) (is-restarting) (current-command . #s(haskell-command :state #1 :go #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_12> :live #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_13> :complete #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_14>)) (suggested-imported) (sent-stdin) (evaluating) (session (name . "haskell") (next-error-region #<marker at 338 in *haskell*> . #<marker (moves after insertion) at 338 in *haskell*>) (next-error-locus) (interactive-buffer . #<buffer *haskell*>) (current-dir . "/home/rvs314/.tmp/") (cabal-checksum) (cabal-dir . "/home/rvs314/.tmp/") (process . #3))) "show" 250) "<interactive>:19:1-4: error: [GHC-39999]\n    • No instance for ‘Show (() -> String)’\n        arising from a use of ‘print’\n        (maybe you haven't applied a function to enough arguments?)\n    • In a stmt of an interactive GHCi command: print it\n\n")
  haskell-command-exec-complete(#s(haskell-command :state (((name . "haskell") (next-error-region #<marker at 338 in *haskell*> . #<marker (moves after insertion) at 338 in *haskell*>) (next-error-locus) (interactive-buffer . #<buffer *haskell*>) (current-dir . "/home/rvs314/.tmp/") (cabal-checksum) (cabal-dir . "/home/rvs314/.tmp/") (process (name . "haskell") (current-response-cursor . 0) (current-response . "<interactive>:19:1-4: error: [GHC-39999]\n    • No instance for ‘Show (() -> String)’\n        arising from a use of ‘print’\n        (maybe you haven't applied a function to enough arguments?)\n    • In a stmt of an interactive GHCi command: print it\n\n\4") (command-queue) (inferior-process . #<process haskell>) (is-restarting) (current-command . #1) (suggested-imported) (sent-stdin) (evaluating) (session . #3))) ((name . "haskell") (current-response-cursor . 0) (current-response . "<interactive>:19:1-4: error: [GHC-39999]\n    • No instance for ‘Show (() -> String)’\n        arising from a use of ‘print’\n        (maybe you haven't applied a function to enough arguments?)\n    • In a stmt of an interactive GHCi command: print it\n\n\4") (command-queue) (inferior-process . #<process haskell>) (is-restarting) (current-command . #1) (suggested-imported) (sent-stdin) (evaluating) (session (name . "haskell") (next-error-region #<marker at 338 in *haskell*> . #<marker (moves after insertion) at 338 in *haskell*>) (next-error-locus) (interactive-buffer . #<buffer *haskell*>) (current-dir . "/home/rvs314/.tmp/") (cabal-checksum) (cabal-dir . "/home/rvs314/.tmp/") (process . #4))) "show" 250) :go #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_12> :live #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_13> :complete #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_14>) "<interactive>:19:1-4: error: [GHC-39999]\n    • No instance for ‘Show (() -> String)’\n        arising from a use of ‘print’\n        (maybe you haven't applied a function to enough arguments?)\n    • In a stmt of an interactive GHCi command: print it\n\n")
  haskell-process-collect(((name . "haskell") (next-error-region #<marker at 338 in *haskell*> . #<marker (moves after insertion) at 338 in *haskell*>) (next-error-locus) (interactive-buffer . #<buffer *haskell*>) (current-dir . "/home/rvs314/.tmp/") (cabal-checksum) (cabal-dir . "/home/rvs314/.tmp/") (process (name . "haskell") (current-response-cursor . 0) (current-response . "<interactive>:19:1-4: error: [GHC-39999]\n    • No instance for ‘Show (() -> String)’\n        arising from a use of ‘print’\n        (maybe you haven't applied a function to enough arguments?)\n    • In a stmt of an interactive GHCi command: print it\n\n\4") (command-queue) (inferior-process . #<process haskell>) (is-restarting) (current-command . #s(haskell-command :state (#1 #10 "show" 250) :go #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_12> :live #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_13> :complete #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_14>)) (suggested-imported) (sent-stdin) (evaluating) (session . #1))) " print it\n\n\4" ((name . "haskell") (current-response-cursor . 0) (current-response . "<interactive>:19:1-4: error: [GHC-39999]\n    • No instance for ‘Show (() -> String)’\n        arising from a use of ‘print’\n        (maybe you haven't applied a function to enough arguments?)\n    • In a stmt of an interactive GHCi command: print it\n\n\4") (command-queue) (inferior-process . #<process haskell>) (is-restarting) (current-command . #s(haskell-command :state (((name . "haskell") (next-error-region #<marker at 338 in *haskell*> . #<marker (moves after insertion) at 338 in *haskell*>) (next-error-locus) (interactive-buffer . #<buffer *haskell*>) (current-dir . "/home/rvs314/.tmp/") (cabal-checksum) (cabal-dir . "/home/rvs314/.tmp/") (process . #3)) #3 "show" 250) :go #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_12> :live #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_13> :complete #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_14>)) (suggested-imported) (sent-stdin) (evaluating) (session (name . "haskell") (next-error-region #<marker at 338 in *haskell*> . #<marker (moves after insertion) at 338 in *haskell*>) (next-error-locus) (interactive-buffer . #<buffer *haskell*>) (current-dir . "/home/rvs314/.tmp/") (cabal-checksum) (cabal-dir . "/home/rvs314/.tmp/") (process . #3))))
  haskell-process-filter(#<process haskell> " print it\n\n\4")

The response GHC seems to be giving back is:

<interactive>:24:1-3: error: [GHC-39999]
    • No instance for ‘Show (Integer -> Integer -> Integer)’
        arising from a use of ‘print’
        (maybe you haven't applied a function to enough arguments?)
    • In a stmt of an interactive GHCi command: print it

Which doesn't match the regexes used in the definition of haskell-interactive-mode-trigger-compile-error when first checking for an error (there's no newline to begin the message) then later when it is checked to be a Show error (GHC uses rather than ( to delimit the constraint). If you modify them to match the error message, then everything else works. I'm not sure if this is a regression that should be solved that way, as I'm not too familiar with the internals of how the process handling works, but I'd be happy to send over my changes as a PR if they are appropriate.

Versions ``` ~ $ version GNU Emacs 30.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.51, cairo version 1.18.4) of 2025-12-03, modified by Debian ~ $ ghc --version The Glorious Glasgow Haskell Compilation System, version 9.12.2 ```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions