Skip to content

haskell-debug parse error #399

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

Closed
dschrempf opened this issue Dec 16, 2014 · 7 comments
Closed

haskell-debug parse error #399

dschrempf opened this issue Dec 16, 2014 · 7 comments

Comments

@dschrempf
Copy link

Hello,

I tried to debug qsort with haskell-debug (cf. ghci debugger). When I try to step through qsort.hs I get a parse error after about 5 to 10 steps:

Debugger entered--Lisp error: (error "Unable to parse history entry: -1  : qsort:(...) (/home/dominik/Dropbox/programming/haskell/myqsort.hs:3:24-56)")
  signal(error ("Unable to parse history entry: -1  : qsort:(...) (/home/dominik/Dropbox/programming/haskell/myqsort.hs:3:24-56)"))
  error("Unable to parse history entry: %s" "-1  : qsort:(...) (/home/dominik/Dropbox/programming/haskell/myqsort.hs:3:24-56)")
  haskell-debug-parse-history-entry("-1  : qsort:(...) (/home/dominik/Dropbox/programming/haskell/myqsort.hs:3:24-56)")
  mapcar(haskell-debug-parse-history-entry ("-1  : qsort:(...) (/home/dominik/Dropbox/programming/haskell/myqsort.hs:3:24-56)" "-2  : qsort (/home/dominik/Dropbox/programming/haskell/myqsort.hs:(1,1)-(3,56))" "-3  : qsort (/home/dominik/Dropbox/programming/haskell/myqsort.hs:2:16-25)" "-4  : qsort (/home/dominik/Dropbox/programming/haskell/myqsort.hs:2:16-47)" "-5  : qsort (/home/dominik/Dropbox/programming/haskell/myqsort.hs:(1,1)-(3,56))" "-6  : main (/home/dominik/Dropbox/programming/haskell/myqsort.hs:5:15-47)" "-7  : main (/home/dominik/Dropbox/programming/haskell/myqsort.hs:5:8-48)"))
  haskell-debug-get-history()
  haskell-debug/refresh()
  haskell-debug-start(((name . "haskell") (next-error-region #<marker at 1 in *haskell*> . #<marker (moves after insertion) at 362 in *haskell*>) (next-error-locus) (interactive-buffer . #<buffer *haskell*>) (current-dir . "/home/dominik/Dropbox/programming/haskell/") (cabal-checksum) (cabal-dir . "/home/dominik/Dropbox/programming/haskell/") (process (name . "haskell") (current-response-cursor . 0) (current-response . "") (command-queue) (inferior-process . #<process haskell>) (is-restarting) (current-command) (suggested-imported) (sent-stdin) (evaluating) (session (name . "haskell") (next-error-region #<marker at 1 in *haskell*> . #<marker (moves after insertion) at 362 in *haskell*>) (next-error-locus) (interactive-buffer . #<buffer *haskell*>) (current-dir . "/home/dominik/Dropbox/programming/haskell/") (cabal-checksum) (cabal-dir . "/home/dominik/Dropbox/programming/haskell/") #1))))
  haskell-debug()
  call-interactively(haskell-debug record nil)
  command-execute(haskell-debug record)
  execute-extended-command(nil "haskell-debug")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

The file qsort.hs:

qsort [] = []
qsort (a:as) = qsort left ++ [a] ++ qsort right
  where (left,right) = (filter (<=a) as, filter (>a) as)

main = print (qsort [8, 4, 0, 3, 1, 23, 11, 18])

Best,
Dominik

@gracjan
Copy link
Contributor

gracjan commented Jan 18, 2015

I tried to reproduce this, but failed.
@fazky : can you tell your version of GHCi, GHC, and just copy and paste what your session looks like?

@chrisdone
Copy link
Member

For what it's worth after implementing this and using GHCi some, I've found the ghci debugger to be drastically useless. Setting a breakpoint almost always results in a no-op which GHCi simply ignores. It's a pity because the mode I made is nice. But it's a real stab in the dark whether GHCi underneath will behave in a predictable manner, otherwise I'd be using this all the time.

@gracjan
Copy link
Contributor

gracjan commented Jan 18, 2015

True and sad.
Lets wait till end of Feb 2015 so that @fazky can provide more info. If not close this as 'cannot reproduce'.

@dschrempf
Copy link
Author

Hello,

the error is still there; maybe I got something wrong in my configuration. I can reproduce it with:

  1. Open myqsort.hs (given above) in haskell-mode.
  2. Start interpreter: C-c C-z y RET RET
  3. Load myqsort.hs in interpreter: :l myqsort.hs.
  4. Switch back to the myqsort.hs buffer and open M-x haskell-debug.
  5. Insert a breakpoint at function main with hotkey b.
  6. Step into expression main with hotkey s.
  7. At the 8th step the error happens.

My ghci session (version 7.8.4):

The lambdas must flow.
If I break, you can:
  1. Restart:           M-x haskell-process-restart
  2. Configure logging: C-h v haskell-process-log (useful for debugging)
  3. General config:    M-x customize-mode
  4. Hide these tips:   C-h v haskell-process-show-debug-tips
Changed directory: /home/dominik/Dropbox/programming/haskell/
λ> :l myqsort.hs
[1 of 1] Compiling Main             ( myqsort.hs, interpreted )
Ok, modules loaded: Main.
λ> 

My haskell-debug session one step before the error happens:

Debugging haskell

s - step into an expression, b - breakpoint
d - delete breakpoint, a - abandon context, c - continue
p - previous step, n - next step
g - refresh

Context

main - myqsort.hs (stopped)

(filter (<=a) as, filter (>a) as)

_result :: ([Integer], [Integer]) = _
a :: Integer = 8
as :: [Integer] = [4,0,3,1,23,....]

   6 qsort [] = [] qsort (a:as) = qsort left ++ [a] ++ qsort right where (left,right) = (filter (<=a) as, filter (>a) as)
   5 qsort left
   4 qsort left ++ [a] ++ qsort right
   3 qsort [] = [] qsort (a:as) = qsort left ++ [a] ++ qsort right where (left,right) = (filter (<=a) as, filter (>a) as)
   2 qsort [8, 4, 0, 3, 1, 23, 11, 18]
   1 print (qsort [8, 4, 0, 3, 1, 23, 11, 18])

breakpoints

0 - Main (5:8)

Modules

Main - myqsort.hs

I hope this helps,
Dominik

Edit: I use haskell-mode from MELPA version 20150108.346

@gracjan
Copy link
Contributor

gracjan commented Jan 21, 2015

Thanks, that should help to reproduce the problem!

@abbradar
Copy link

abbradar commented Apr 3, 2015

I have probably somewhat related bug -- haskell-debug cannot parse operator <|> (maybe others, haven't studied it better). I can provide more info if it can't be reproduced. I have haskell-mode-20150331.1140.

@gracjan
Copy link
Contributor

gracjan commented Feb 22, 2016

Closing as old. If somebody would like to take case of haskell-debug.el then we can talk again.

@gracjan gracjan closed this as completed Feb 22, 2016
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

No branches or pull requests

4 participants