[Haskell-cafe] Unnecessarily strict implementations

Neil Brown nccb2 at kent.ac.uk
Thu Sep 2 12:27:02 EDT 2010


On 02/09/10 17:10, Stephen Sinclair wrote:
> On Thu, Sep 2, 2010 at 3:25 AM, Jan Christiansen
> <jac at informatik.uni-kiel.de>  wrote:
>    
>> I prefer
>>
>>   False<= _|_ = True
>>      
> Sorry to go a bit off topic, but I find it funny that I never really
> noticed you could perform less-than or greater-than comparisons on
> Bool values.  What's the semantic reasoning behind allowing relative
> comparisons on booleans?  In what context would you use it?  It seems
> to me a throwback to C's somewhat arbitrary assumption that False=0
> and True=1.
>    
Comparison on Bool itself is probably not particularly useful.  But it 
is often useful if the Bool is part of a larger data structure.  For 
example, I might want to have Set (String, Bool); without the Ord 
instance on Bool I couldn't do this.  Similarly, you couldn't derive Ord 
on your data types that have Bool in them without the Ord Bool instance.

Thanks,

Neil.



More information about the Haskell-Cafe mailing list