[Haskell] RFC: DData in hierarchical libraries

Christian Maeder maeder at tzi.de
Thu Mar 11 15:21:24 EST 2004

Hi Daan,

>> Set.toAscList is not really necessary as it is the same as Set.toList.
> Not necessarily: the lists from Set.toList will be equal for equal 
> Set's, but may be unordered. Use "toAscList" or "toDescList" if you
 > want an ordered variant.

That really surprises me. I think that toList must return a sorted list 
(to properly abstract the Set data type), and anything unsorted should 
only be for debugging purposes.

>> The functions Set.fromAscList and Set.fromAscDistinctList should be 
>> marked as "unsafe"
> I think so too, although I like "unchecked" better?

Good, I agree.

>> Map.keySet = Set.fromDistinctAscList . Map.keys

> Yes, we could do that -- but the circular dependency is terrible, and a 
> wrapper module
> would need to look at the internal representation of Map/Set :-(

I don't see the circular dependency. Map imports Set (but not vice 
versa?). In any case, I would prefer a wrapper (possible revealing some 
more "unchecked" functions).


More information about the Libraries mailing list