什么是Haskell的多态的风格? [英] What is Haskell's style of polymorphism?
问题描述
的确,Haskell同时支持(更高级别)参数多态和ad hoc(或 bounded )多态性。 Haskell中的参数多态性是通过其Hindley-Milner / 系统F 类型系统来支持的。特别的多态性是通过类型类来支持的。
对于类型类和特别多态的起源,请参阅Wadler的论文:
- 如何使临时多态性不那么特别,Philip Wadler和Stephen Blott。第16届计算语言原理研讨会,ACM出版社,德克萨斯州奥斯汀,1989年1月。
关于区分参数化和ad hoc多态性,您可以挖掘Strachey的论文, b
$ b
With Haskell's type classes it almost seems that it enables ad hoc polymorphism, but its functions declarations seem parametric polymorphism. Am I mixing my understanding of different things?
Indeed, Haskell supports both (higher rank) parametric polymorphism, and ad hoc (or bounded) polymorphism. Parametric polymorphism in Haskell is supported via its Hindley-Milner/System F type system. Ad hoc polymorphism is supported via type classes.
For the origin of type classes and ad hoc polymorphism, see Wadler's papers:
- How to make ad-hoc polymorphism less ad hoc, Philip Wadler and Stephen Blott. 16'th Symposium on Principles of Programming Languages, ACM Press, Austin, Texas, January 1989.
For the origin of the distinction between parametric and ad hoc polymorphism, you can dig up Strachey's papers,
- C. Strachey, Fundamental concepts in programming languages. Lecture notes for the International Summer School in Computer Programming, Copenhagen, August 1967
这篇关于什么是Haskell的多态的风格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!