Ivan Lazar Miljenovic schrieb:
On 3 September 2010 16:49, Henning Thielemann
<[email protected]> wrote:
You might object, that it is seldom, that someone intentionally writes
(a<b) if 'a' and 'b' are complex numbers. However imagine someone
rewrites an algorithm for real numbers to complex numbers and he relies
on the type system to catch all inconsistencies. The field operations
can remain the same, but (<) has to be applied to results of 'abs',
'realPart' or other functions that yield a real.
Fair enough, but on the other hand I don't think we should make a
fetish about enforcing _everything_ in the type system (non-empty
lists, etc.).
I would like to express even more in type system. For instance I have
recently invested several weeks for hunting space leaks in my code and
I'm still not sure, I catched them all. A way to express absence of
space leaks in the type system would save me a lot of time and would
give me confidence.
Regarding True=1 and False=0:
Once I programmed in a language where True was represented by -1,
because this is represented by bit pattern 1....1. The CPU has an
instruction to fill a byte with the content of a flag and you can use
this bit pattern for bitwise AND and OR operations. This makes this
representation very efficient. This programming language also allowed
comparison and conversion of True and False to their numeric
representations. I used this intensively. Now imagine I port such
programs to Haskell or C, I get lots of bugs for free.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe