In de book Modern C++ design, Andrei Alexandrescu writes that Haskell
supports “multi-methods”
http://books.google.com/books?id=aJ1av7UFBPwCpg=PA3ots=YPiJ_nWi6Ydq=moder
n+C%2B%2Bsig=FWO6SVfIrgtCWifj9yYHj3bnplQ#PPA263,M1
How is this actually done in Haskell? Maybe this is just a basic feature of
peterv wrote:
In de book Modern C++ design, Andrei Alexandrescu writes that Haskell
supports “multi-methods”
Using multi-methods, I could write (in pseudo code)
collide (Asteroid, Planet) = an asteroid hit a planet
collide (Asteroid, Earth) = the end of the dinos
...
collide (Planet,
Remember that type classes do not provide object-oriented functionality.
The dispatch is static, not dynamic. Although OOP can be simulated in
Haskell, it is not a natural idiom. If you need dynamic dispatch
(including multiple dispatch), you may want to reconsider your solution.
Dan Weston
peterv schrieb:
In de book Modern C++ design, Andrei Alexandrescu writes that Haskell
supports “multi-methods”
http://books.google.com/books?id=aJ1av7UFBPwCpg=PA3ots=YPiJ_nWi6Ydq=moder
n+C%2B%2Bsig=FWO6SVfIrgtCWifj9yYHj3bnplQ#PPA263,M1
Chapter 11, Page 263 of this books:
The C++ virtual
Dan Weston wrote:
Remember that type classes do not provide object-oriented
functionality. The dispatch is static, not dynamic. Although OOP can
be simulated in Haskell, it is not a natural idiom. If you need
dynamic dispatch (including multiple dispatch), you may want to
reconsider your
question: multi-methods in Haskell
Dan Weston wrote:
Remember that type classes do not provide object-oriented
functionality. The dispatch is static, not dynamic. Although OOP can
be simulated in Haskell, it is not a natural idiom. If you need
dynamic dispatch (including multiple dispatch
peterv wrote:
This is very nice, but it does not really solve the original problem.
To get Haskell to choose the best fit it's necessary to encode the
location of each element in the hierarchy, so that elements deeper in
the hierarchy are more instantiated than those at the top. Then