In Haskell, the closest you have is "class". This class though not as same as the class in Java and C++ , will work for what you want in this case.
In your case this is how your code will look.
class Animal a where say :: String -> sound
Then you can have individual data types adapting these methods.
instance Animal Dog where say s = "bark " ++ s
EDIT :- Before you can specialize say for Dog you need to tell the system that Dog is animal.
data Dog = \--something here --\ (deriving animalAnimal)
EDIT :- For Wilq.
Now if you want to use say in a function say foo, you will have to tell haskell that foo can only work with Animal.
foo :: (Animal a) => a -> String -> String foo a str = say a str
now if you call foo with dog it will bark, if you call with cat it will meow.
main = do
let d = dog (\--cstr parameters--\)
c = cat
in show $ foo d "Hello World"
You now can not have any other definition of function say. If say is called with anything which is not animal, it will cause compile error.