No way to retrieve the base of a Set or Map in O(1)

Milan Straka fox at
Thu Jun 18 11:01:14 UTC 2015

Hi André,

> -----Original message-----
> From: André van Delden <andre.van.delden at>
> Sent: 18 Jun 2015, 12:27
> there seems to be no way to retrieve the base of a Set or Map in O(1),
> since there is no relevant function in the respective libraries and the
> constructors Bin and Tip are not exported in any module.
> I think retrieving any one element from a Set or Map might be useful
> sometimes, so I modestly ask for an implementation.

do you have any use-case where such function is useful? I am having
troubles imagining one.

Also note that for IntMap and IntSet you cannot provide such function.

To me, this seems more like accessing the internal representation. There
have been some discussions about exporting the internal representations
in an Unsafe module, which would have no API guarantees (i.e., have
Data.Set.Unsafe exporting the Set constructor). Do you really want the
proposed function, or would you be more interested in accessing the
internal representation?


More information about the Libraries mailing list