[Haskell] Typing in haskell and mathematics

Jeremy Gibbons jeremy.gibbons at comlab.ox.ac.uk
Mon Jan 31 20:41:47 EST 2005


On 1 Feb 2005, at 05:20, Cale Gibbard wrote:

> Statements like "a < b < c" are perfectly clear to everyone present,
> and if anyone has a type error in their head when reading that which
> they can't get past, they are most likely just being stubborn.

Actually, that's another nice example of what I was talking about. If 
booleans are ordered, as they are in Haskell (namely, instance Ord 
Bool), then this is not perfectly clear at all - at least, it means 
something different from what I think you think it means.

The expression "(2 < 1) < True" is syntactically valid and type correct 
in Haskell, and evaluates to True (because False < True). Similarly, 
"(True < False) < True" is True, whereas "True < (False < True)" is 
False, so < is not associative. If you want "a < b < c" to mean "(a < 
b) && (b < c)" but "a + b + c" to mean "(a + b) + c", you're going to 
have to treat "<" differently from "+", which goes against the spirit 
of considering them both simply functions.

(I'm talking here of course in the context of a programming language, 
where the original question was asked and where consistency is 
important; you can have as many inconsistencies as you like on a 
blackboard.)

On Mon, 31 Jan 2005 13:59:58 +0100, Benjamin Franksen 
<benjamin.franksen at bessy.de> wrote:
>> (Witness "sigma
>> sin(x) dx", involving a term sin(x) and a dummy variable x, rather
>> than the more logical "sigma sin", involving the function.)
>
> BTW, 'sigma sin' is not a function.

I'm missing something here. I don't have an integral symbol to hand, 
which is what I meant by the "sigma", so perhaps I was unclear. I'd say 
the integral of the sine function is itself a binary function, taking 
lower and upper bounds as arguments.

Jeremy

Jeremy.Gibbons at comlab.ox.ac.uk
   Oxford University Computing Laboratory,    TEL: +44 1865 283508
   Wolfson Building, Parks Road,              FAX: +44 1865 273839
   Oxford OX1 3QD, UK.
   URL: http://www.comlab.ox.ac.uk/oucl/people/jeremy.gibbons.html



More information about the Haskell mailing list