Type classes in Mercury

D. Jeffery, F. Henderson, Z. Somogyi
{"title":"Type classes in Mercury","authors":"D. Jeffery, F. Henderson, Z. Somogyi","doi":"10.1109/ACSC.2000.824391","DOIUrl":null,"url":null,"abstract":"The type systems of functional languages such as Haskell have recently become more powerful and expressive. They not only allow programmers to write code that works on values of any type (genericity), they also allow programmers to require that a particular type belongs to a given type class (constrained genericity). Such code may use any of the methods of the type class, since every type that is a member of the type class must implement those methods. This capability makes it significantly easier to express solutions to many common problems, and promotes code reuse. Incorporating type classes in a logic programming language provides some new challenges. In this paper, we explain how we have extended Mercury's type system to include support for type classes. We show that type classes integrate very nicely with Mercury's mode, determinism and uniqueness systems, and describe how our implementation works.","PeriodicalId":304540,"journal":{"name":"Proceedings 23rd Australasian Computer Science Conference. ACSC 2000 (Cat. No.PR00518)","volume":"3 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2000-01-31","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"19","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Proceedings 23rd Australasian Computer Science Conference. ACSC 2000 (Cat. No.PR00518)","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1109/ACSC.2000.824391","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 19

Abstract

The type systems of functional languages such as Haskell have recently become more powerful and expressive. They not only allow programmers to write code that works on values of any type (genericity), they also allow programmers to require that a particular type belongs to a given type class (constrained genericity). Such code may use any of the methods of the type class, since every type that is a member of the type class must implement those methods. This capability makes it significantly easier to express solutions to many common problems, and promotes code reuse. Incorporating type classes in a logic programming language provides some new challenges. In this paper, we explain how we have extended Mercury's type system to include support for type classes. We show that type classes integrate very nicely with Mercury's mode, determinism and uniqueness systems, and describe how our implementation works.
在Mercury中键入类
函数式语言(如Haskell)的类型系统最近变得更加强大和富有表现力。它们不仅允许程序员编写处理任何类型值的代码(泛型),还允许程序员要求特定类型属于给定类型类(约束泛型)。这样的代码可以使用类型类的任何方法,因为作为类型类成员的每个类型都必须实现这些方法。这个功能使得表达许多常见问题的解决方案变得非常容易,并促进了代码重用。在逻辑编程语言中合并类型类带来了一些新的挑战。在本文中,我们将解释如何扩展Mercury的类型系统以包含对类型类的支持。我们展示了类型类与Mercury的模式、确定性和唯一性系统非常好地集成,并描述了我们的实现是如何工作的。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信