Efficient or predictable Ord for Typeable

30 Nov
2004
30 Nov
'04
4:54 a.m.
Simon PJ wrote (snipped):
This unfortunate observabilty of an ordering (or hash value) that is needed only for efficient finite maps, is very annoying. I wish I knew a way round it. As it is we can pick a) expose Ord/Hash, but have unpredictable results b) not have Ord/Hash, but have inefficient maps
In this case there is a simple solution. Simply define newtype FastUnpredictableInstances a = FastUnpredictableInstances a and define the fast Ord and Hash only for FastUnpredictableInstances. People who manage to type all that then have no grounds to grumble if they get bitten. For something as basic as implementing execution contexts, FastUnpredictableInstances is acceptable.
7476
Age (days ago)
7476
Last active (days ago)
0 comments
1 participants
participants (1)
-
George Russell