[Haskell-cafe] Efficient records with arbitrarily many fields [was: Extensible states]
ben.franksen at online.de
Sat Jul 4 14:13:01 UTC 2015
Nikita Volkov wrote:
> I somehow missed the preceding discussion, so I'll comment on what I've
> seen so far.
>> I think the most reasonable default is O(1) for lookup and O(n) for
>> extension, like in Nikita Volkov's record package. It is quite
>> unfortunate that this package limits the number of fields! If GHC would
>> offer generic support for tuples of arbitrary size (with the same
>> efficiency as today) this limitation could be avoided and all would be
> Currently "record" is limited to up to 24 fields. However it was just an
> arbitrary number that I've chosen. No part of GHC limits us to that
> The only reason I'm not introducing bigger arities is that
> unfortunately the compilation time of the "record" library grows
> exponentially in relation to the highest arity supported. I expect, that
> limitation could be lifted once/if the ideas behind the library get
> implemented as an extension to GHC.
Thanks for the clarification. So there is no hard limit in GHC, but we are
(currently) limited by other factors. Some (more or less) minimal compiler
support is, I guess, necessary to make any of the existing record libraries
practical for real world programs.
"Make it so they have to reboot after every typo." ― Scott Adams
More information about the Haskell-Cafe