Hi,
A while back I asked about OO programming in Haskell and discovered existential types. I understood that existential types allowed me to write heterogeneous lists which seemed sufficient at the time.
Now trying to combine those ideas with records:
data AnyNode = forall a. Node a => AnyNode a
class Node -- yadda yadda
data Branch = Branch { name :: String, description :: String, children :: [AnyNode] }
data Leaf = Leaf { name :: String, value :: String }
The problem here is I can't use the same 'name' field for both Branch and Leaf. Ideally I'd like the name field in the Node class, but it doesn't seem that Haskell classes are for that sort of thing.
-John