2 ms·
IIRC, "bound" has more to do with quantification than polymorphism more generally. There is "parametric" vs "ad-hoc". https://stackoverflow.com/questions/67301
by steveklabnik 9y ago
IIRC, "bound" has more to do with quantification than polymorphism more generally.
There is "parametric" vs "ad-hoc". https://stackoverflow.com/questions/6730126/parametric-polymorphism-vs-ad-hoc-polymorphism https://stackoverflow.com/questions/6730126/parametric-polym... has a link to the text of TAPL explaining the difference here.
Rust traits and Haskell typeclasses would be ad-hoc.
- leshow 9y agoThat's interesting, I always assumed parametric polymorphism was a requirement of ad hoc polymorphism. I suppose I'm using a more narrow definition. On the opposite end, Elm for instance, has parametric polymorphism: type Parametric a = Parametric a f : (a -> b) -> Parametric a -> Parametric b f fn (Parametric a) = Parametric <| fn a but no support for ad-hoc, like you said, in Haskell: data Parametric a = Parametric a f :: Ord a => Parametric a -> Parametric a -> Parametric a f (Parametric a) (Parametric b) = Parametric (min a b)