[Haskell-cafe] instance Monad m => Functor m

Hans Aberg haberg at math.su.se
Thu Apr 10 13:28:02 EDT 2008

On 9 Apr 2008, at 17:49, Henning Thielemann wrote:
> Additionally I see the problem, that we put more interpretation  
> into standard symbols by convention. Programming is not only about  
> the most general formulation of an algorithm but also about error  
> detection. E.g. you cannot compare complex numbers in a natural  
> way, that is
>   x < (y :: Complex Rational)
>  is probably a programming error. However, some people might be  
> happy if (<) is defined by lexicgraphic ordering. This way complex  
> numbers can be used as keys in a Data.Map. But then accidental uses  
> of (<) could no longer be detected. (Thus I voted for a different  
> class for keys to be used in Data.Map, Data.Set et.al.)

If one just needs to compare equal and unequal elements, then a hash- 
map is faster than a balanced tree map, and a total order is not  
needed. So those that want to use complex numbers as keys perhaps  
have not considered that possibility.

And if one considers a total order (<) for all data types, then if  
that includes functions, then it may happen that two equal functions  
f, g satisfy f < g. So it would not have the expected semantic  


More information about the Haskell-Cafe mailing list