Generic tries (long)

Adrian Hey ahey at
Sun Jun 22 02:34:16 EDT 2008

Hello Jamie,

Jamie Brandon wrote:

> I like focus, alter and merge.

I've been thinking about the merge function. I think structurally it
would be a bit like unionMaybe with mapMaybe applied to the
non-overlapping bits. So it's hard to see how this could ever come
close to the efficiency of the specialised union,intersection etc..

But it still looks like it could be useful in some situations (as a more
efficient and flexible alternative to a union followed by a mapMaybe
say), so would be worth implementing I think.

..and of course we'd probably want a version that didn't take keys
as argument too.

> If not, I dont want to have a class definition that makes it
> difficult to write efficient implentations. I would rather have an
> ugly class and a nicer layer on top.

Yes, we don't want to go to all this trouble to produce "efficient" maps
and then throw it all away in the name of elegance. MHO too is that if
efficiency requires a big ugly class definition then let it be big
and ugly :-)

Adrian Hey

More information about the Libraries mailing list