Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Polymorphism

Name: Anonymous 2007-12-05 17:37

WTF IS POLYMORPHISM?!

Name: Anonymous 2007-12-05 21:32

>>9
Multimethods? Is that kind of like this:
data Data= String String | Bool Bool
f :: Data -> ()
-- Dispatch on the type of the arguments
f (String _) = {- Stuff -} ()
f (Bool _) = {- Stuff -} ()

Or is it more like:
class Class a where
    f :: a -> ()
instance Class String where
    f _ = {- Stuff -} ()
instance Class Bool where
    f _ = {- Stuff -} ()

?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List