简体   繁体   中英

What is Haskell's style of polymorphism?

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:

For the origin of the distinction between parametric and ad hoc polymorphism, you can dig up Strachey's papers,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM