arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1612.08199cs.PL
收藏

一种简单的Haskell重载语义

A Simple Semantics for Haskell Overloading

J. Garrett Morris

摘要:

正如最初提出的那样,类型类提供了重载和特殊定义,但仍然可以根据严格的参数演算来理解(和实现)。对于类型类的后续扩展,情况并非如此。函数依赖和相等约束允许谓词的可满足性来细化类型;这意味着等效限定类型的解释可能是不可互换的。重叠的实例和实例链允许谓词在不确定其关联类方法的实现的情况下得到满足,从而引入真正的非参数行为。我们提出了一种新的方法类型类的语义,解释多态表达式的每个地面实例的行为,但不需要这些行为被参数化确定。我们认为,这种方法既符合限定类型的直观含义,又准确地模拟了程序的行为

英文摘要:

As originally proposed, type classes provide overloading and ad-hoc definition, but can still be understood (and implemented) in terms of strictly parametric calculi. This is not true of subsequent extensions of type classes. Functional dependencies and equality constraints allow the satisfiability of predicates to refine typing; this means that the interpretations of equivalent qualified types may not be interconvertible. Overlapping instances and instance chains allow predicates to be satisfied without determining the implementations of their associated class methods, introducing truly non-parametric behavior. We propose a new approach to the semantics of type classes, interpreting polymorphic expressions by the behavior of each of their ground instances, but without requiring that those behaviors be parametrically determined. We argue that this approach both matches the intuitive meanings of qualified types and accurately models the behavior of programs

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑