Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get a callstack in Haskell?

I am trying to track down a non-exhaustive pattern in a libraries code. Specifically HDBC's mysql implementation. It is trying to match over types in my program and map them to mysql's types I believe. I can't seem to get a callstack for this error which means that since there are a number of parameters to the SQL query it is difficult to track down exactly what is causing it.

Is it possible to get a callstack in haskell so I would know which parameter was causing the error? Also I would think that this should be caught by the compiler since it should be able to look at my types and the patterns and make sure that there was a corresponding match.

like image 495
Steve Severance Avatar asked Jul 10 '10 21:07

Steve Severance


2 Answers

You can use the GHCi debugger to identify where the exception is coming from.

I walk through a full example here.

like image 135
Don Stewart Avatar answered Oct 07 '22 23:10

Don Stewart


You might also take a look at the Debug.Trace library.

like image 43
Axle Avatar answered Oct 07 '22 22:10

Axle