计算机科学 > 程序设计语言
[提交于 2019年6月28日]
标题:Bidirectional Type Class Instances (Extended Version)
查看原文 PDF 中文 PDF (下批处理) EasyResearch 阅读摘要:GADTs were introduced in Haskell's eco-system more than a decade ago, but their interaction with several mainstream features such as type classes and functional dependencies has a lot of room for improvement. More specifically, for some GADTs it can be surprisingly difficult to provide an instance for even the simplest of type classes. In this paper we identify the source of this shortcoming and address it by introducing a conservative extension to Haskell's type classes: Bidirectional Type Class Instances. In essence, under our interpretation class instances correspond to logical bi-implications, in contrast to their traditional unidirectional interpretation. We present a fully-fledged design of bidirectional instances, covering the specification of typing and elaboration into System FC, as well as an algorithm for type inference and elaboration. We provide a proof-of-concept implementation of our algorithm, and revisit the meta-theory of type classes in the presence of our extension.
提交历史
来自:Koen Pauwels[v1] 2019年6月28日 星期五 14:35:28 UTC