I´m just thinking aloud, but, because incorporating deeper mathematics
concepts has proven to be the best solution for better and more flexible
programming languages with fewer errors, I wonder if raising the type
classes incorporating axioms can solve additional problems.
At first sight it does:
class Abelian a where
(+) :: a -> a -> a
property ((+))= a+b == b+a
this permits:
1- safer polimorphism: I can safely reuse the operator + if the type
and the property is obeyed. The lack of ability to redefine operators is a
problem for DSLs that must use wreid symbols combinations with unknow
meanings. To use common operators with fixed properties is very good. the
same aplies for method names.
2- the compiler can use the axions as rewrite rules.
3- in debugging mode, it is possible to verify the axiom for each value a
generated during execution. Thus, a generator is not needed like in
quickcheck. The logic to quickcheck can be incorporated in the debugging
executable.
3 guaranties that 1 and 2 are safe.
a type class can express a relation between types, but it is not possible
to define relation between relations.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe