如何在Haskell中获得一个callstack? [英] How do I get a callstack in Haskell?

查看:114
本文介绍了如何在Haskell中获得一个callstack?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图追踪图书馆代码中的一个非穷尽的模式。具体来说HDBC的mysql实现。它试图在我的程序中匹配类型,并将它们映射到我认为的mysql类型。我似乎无法得到这个错误的调用堆栈,这意味着由于SQL查询中有许多参数,所以很难准确地跟踪导致它的原因。



是否可以在haskell中获取一个callstack,以便我知道哪个参数导致错误?我也会认为这应该被编译器所捕获,因为它应该能够查看我的类型和模式,并确保有一个相应的匹配。

解决方案

您可以使用确定异常来自哪里



我走过一个完整的例子这里


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.

解决方案

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

I walk through a full example here.

这篇关于如何在Haskell中获得一个callstack?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆