
Am Montag, 21. November 2005 20:34 schrieb Max Eronin:
On 11/21/05, David Roundy
wrote: class Coord a where get_x :: a -> Double get_y :: a -> Double set_x :: Double -> a -> a set_y :: Double -> a -> a
I'd say this is a typical OO solution to the problem that doesn't exist
Why do you need setters and getters for coordinate in purely functional language? Doesn't data Coord = Coord Double Double, functional composition and monads solve problems in way better than inheritance?
The most impressive feature of haskell for me, as a former "OO-design patterns-UML is great" programmer was that I don't have to and in fact must not use OO and inheritance and can write code that doesn't leave you guessing what exactly it is doing and what is not. And that the language forces you make good design decisions and doesn't let you make wrong ones. Inheritance is no doubt one of the most sensless solutions for code reuse i have ever seen.
Yes, yes, yes! :-) Best wishes, Wolfgang