Name: Anonymous 2012-02-12 0:54
Hey /prog/. I'm trying to implement a simple object system in Haskell - nothing too complicated, an object is just an ID and a list of properties - and I'm stuck on how to implement the properties efficiently. The obvious method would be a
The other way I can think of doing it would be
Is there some datatype that would make more sense to use? Or is there a completely different way that I should be doing this?
Thanks.
Map String Value, but I don't want to have to compare a bunch of strings each time I access an object's properties.The other way I can think of doing it would be
data Property = Prop1 | Prop2 | ..., but I don't want to have to explicitly list every property I might want to use. They probably won't even be known at compile-time. Also, I don't want to use Ints because that's not very readable.Is there some datatype that would make more sense to use? Or is there a completely different way that I should be doing this?
Thanks.