
7 Aug
2011
7 Aug
'11
9:21 a.m.
Manfred Lotz
In Lua I could do something like this:
-- initialize empty table P = {}
P.a = "bla1" P.b = "bla2"
and so on.
Now I can refer to each value by name, and I also can easily iterate over the table P.
How can I do something similar in Haskell. Note: I do want only write each variable one time (or two times if I count the type definition).
I think you're not actually asking for record types at all, because that doesn't really fit into Haskell's type system. Rather you may want to have a look at maps. See the Data.Map module. Those are dictionaries with fast update and lookup as well as traversal operations. Greets, Ertugrul -- nightmare = unsafePerformIO (getWrongWife >>= sex) http://ertes.de/