
Hello, why does haskell support only parametric polymorphism? Is it because ad hoc p. || multiple dispatch is bad in general? King Regards, Ford

Hi Ford,
Haskell does support ad-hoc polymorphism via type classes. In short,
class Foo a where
-- type declarations for related sets of functions that are polymorphic
in a go here
instance Foo Int where
-- function definitions with a specialized to Int go here.
The Show class is probably a fairly simple example you can play with in
ghci.
data Test = Test
instance Show Test where
-- show :: Test -> String
show t = "Hello World"
Thanks,
Arjun
On Wed, Jul 6, 2016 at 12:05 PM OxFord
Hello,
why does haskell support only parametric polymorphism?
Is it because ad hoc p. || multiple dispatch is bad in general?
King Regards,
Ford _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
participants (2)
-
Arjun Comar
-
OxFord