
Karl Grapone
I've just started learning Haskell, and I must admit I'm finding it a bit hard to get my head around the typing system...
Okay.
What I want to be able to do is add and remove fields while the system is running,
While I'm sure you'll get some advanced replies to this, IMHO there is a contradiction between static (ie. compile time) type safety, and run-time modification of the types. If you are happy with dynamic typing, I would encode the data fields as lists of (keyword,value) pairs, and insert the necessary checks where appropriate. I.e. something like: type Keyword = String -- alternative: data Keyword = Name | Address |.. type Value = String -- or: data KeyVal = Name String | Number Int |.. data Employee = E [(Keyword,Value)] data Department = D [(Keyword,Value)] You can easily look up and update the field lists by using standard Prelude funcitions. -k -- If I haven't seen further, it is by standing in the footprints of giants