FiniteMap.keysFM

Christian Maeder maeder@Informatik.Uni-Bremen.DE
Wed, 31 Jul 2002 10:57:07 +0200


Keith Wansbrough wrote:

> > I wish "keysFM" would yield "Set key" rather than "[key]"!

> IIRC a Set key is simply a FiniteMap key key.  So what you require is
> simply a mapFM (\k v -> k).

Set is an abstract data type , that can be viewed as a sorted list
without duplicates (or as a special mapp, see below). Simply in order to
document that property "keysFM" should return "Set key"!

You're suggestion "mapFM (\k v -> k)" yields a "FiniteMap key key". The
internal representation, however, is (by mere coincidence) "FiniteMap
key ()", so "mapFM (\k v -> ())" would be a correct implementation, but
only if I knew the internal representation of a set and could use the
hidden constructor for Set. 

> Correct me if I'm wrong...

I hope I did,

Cheers Christian