Showing type when debugging ? - Haskell

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

Vincent L

Hi, I'm using phoityne-vscode to debug my code. I'm trying to implement a monadic parser on top of a free applicative one . I have an issue with some, basically it works but it always "forgets" to parse an element in the list.
I'm a bit lost with phoityne, I put breakpoint but it's hard to know what's happening since all the variable are hidden, due to the lazyness constraint. However I have 2 issues which annoy me with the debugger :

  • since everything is generic (eg Schema a) I can't show the content of the variable even if they are evaluated. Isn't there some kind of binary representation of things ?
  • and in the worst case, isn't it possible to print the actual type of a variable ? I mean in debugging mode Haskell "knows" what is the type of the variable, am I wrong ?
Georgi Lyubenov // googleson78

Vincent L said:

Hi, I'm using phoityne-vscode to debug my code. I'm trying to implement a monadic parser on top of a free applicative one . I have an issue with some, basically it works but it always "forgets" to parse an element in the list.
I'm a bit lost with phoityne, I put breakpoint but it's hard to know what's happening since all the variable are hidden, due to the lazyness constraint. However I have 2 issues which annoy me with the debugger :

  • since everything is generic (eg Schema a) I can't show the content of the variable even if they are evaluated. Isn't there some kind of binary representation of things ?
  • and in the worst case, isn't it possible to print the actual type of a variable ? I mean in debugging mode Haskell "knows" what is the type of the variable, am I wrong ?

you can use Typeable for that, but you need to "pollute" your code with it

Georgi Lyubenov // googleson78

I'm not familiar with whether there's some debug info that you can get from ghc

Vincent L

thank you, will give it a try next time I have to debug code