`haskell-interactive-type-show-for-ambiguous` is not respected

Aperta Adatta ai principianti
#1,889 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
74/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
emacs-lisp, haskell

Direzione di ricerca

Inizia in haskell-interactive-mode.el, in haskell-interactive-mode-trigger-compile-error, soprattutto nei controlli intorno alle righe 1036 e 1045. Riproduci la risposta con GHC 9.12.2 e verifica come viene confrontato il testo dell'errore. Il lavoro è completato quando la visualizzazione del tipo documentata funziona per l'errore Show segnalato e la gestione esistente di process-error rimane intatta.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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 ```
Lingua principale
Emacs Lisp
Stelle
1.4k
Fork
357
Merge medio
7h 50m
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di haskell/haskell-mode

Tutte le issue di haskell/haskell-mode

Issue simili

Altre issue su DevTools

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.