Talk:GHC/GHCi debugger
Add topicHow do I use the debugger on implicitly typed and/or class typed functions? Here is what I am trying:
qsort [] = []
qsort (a:as) = breakpoint $ (qsort left) ++ [a] ++ (qsort right)
where left = filter (<=a) as
right = filter (>a) as
when I execute this into the patched ghci, here is what I get:
*Main> qsort [8, 4, 0, 3, 1, 23, 11, 18] Local bindings in scope: src/Main.hs:7> left <interactive>:1:0: Not in scope: `left' src/Main.hs:7> right <interactive>:1:0: Not in scope: `right' src/Main.hs:7> a <interactive>:1:0: Not in scope: `a'
If I try specifying the inferred type (qsort :: Ord a => [a] -> [a]
), I still get the same result. But if I specify a concrete type for the qsort function (qsort :: [Int] -> [Int]
), the bindings in scope are shown and I can inspect the values.
ThiagoArrais 14:46, 20 July 2006 (UTC)
Is there a mailing list or any kind of user group for this?
ThiagoArrais 14:46, 20 July 2006 (UTC)
Thiago, the wiki is the intended discussion place. I just need to teach the wiki to send me an email when there are new comments here.
You are using 'breakpoint' as it's meant to be used indeed. However, not all the local bindings are available at a breakpoint. Some polymorphically typed values, such as class typed values like your left and right functions above, are not available. Hopefully this can be improved, I will be looking into seeing these restrictions relaxed.
Thanks for the feedback, and keep it coming!
Mnislaih 15:33, 24 July 2006 (UTC)