Skip to content

Instantly share code, notes, and snippets.

@ethagnawl
ethagnawl / polymorphisms.hs
Last active May 3, 2018 12:52
ad hoc vs. parametric polymorphism
-- The key difference between parametric polymorphism and overloading (aka ad-hoc
-- polymorphism) is that parameteric polymorphic functions use one algorithm to
-- operate on arguments of many different types, whereas overloaded functions may
-- use a different algorithm for each type of argument.
-- John Mitchell, Concepts in Programming Languages
-- http://stackoverflow.com/a/13043262/382982
-- ad hoc/constrained => typeclasses
plus :: (Num a) => a -> a -> a