[Haskell-cafe] Sparse records/ADTs

Jon Fairbairn jon.fairbairn at cl.cam.ac.uk
Fri Oct 26 17:17:28 CEST 2012


Twan van Laarhoven <twanvl at gmail.com> writes:

> On 24/10/12 12:08, Jon Fairbairn wrote:
>>
>> Is there a convenient way of handling a data structure with lots
>> of fields of different types that may or may not be filled in?
>>
>
> Not sure about convenience, but here is a type safe solution
> with O(log n) lookups and updates. The idea is to define a
> GADT tree type with a fixed layout:

Thanks for your reply (and for all the others). Since type safe
is something that (for me) goes without saying, this is the best
solution, but it doesn’t really satisfy the convenience aspect.
(I had already looked at solutions using Map and contemplated a
tree structure, but didn’t like anything I had come up with). In
short, it looks like the answer to my question is “No.” :-/

-- 
Jón Fairbairn                                 Jon.Fairbairn at cl.cam.ac.uk




More information about the Haskell-Cafe mailing list