Haskell的类型分类法证明
Proving Type Class Laws for Haskell
摘要:
Haskell中的类型类用于实现ad-hoc多态性,即一种确保程序员和编译器都为特定数据类型定义一组函数的方法。这种类型类的所有实例都应该以某种方式运行,并满足与相应类相关的定律。然而,这些通常只是在评论中陈述,因此,没有真正的方法来强制执行它们。在本文中,我们描述了一个系统,它允许用户写下类型类的法律,然后自动实例化,并发送到一个归纳定理证明器时,声明一个新的类型类的实例。
英文摘要:
Type classes in Haskell are used to implement ad-hoc polymorphism, i.e. a way to ensure both to the programmer and the compiler that a set of functions are defined for a specific data type. All instances of such type classes are expected to behave in a certain way and satisfy laws associated with the respective class. These are however typically just stated in comments and as such, there is no real way to enforce that they hold. In this paper we describe a system which allows the user to write down type class laws which are then automatically instantiated and sent to an inductive theorem prover when declaring a new instance of a type class.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。