3 ms·
The OO approach is possible in Haskell using "existential types". However, this is an extension to the language which is rarely used. The more normal solution
by cia_plant 17y ago
The OO approach is possible in Haskell using "existential types". However, this is an extension to the language which is rarely used.
The more normal solution is to make a single data type which is a disjunction of all the shapes which you want to deal with.