This material is sales and trading
commentary and does not constitute investment research. Please follow the
attached hyperlink to an important disclaimer
<www.credit-suisse.com/emea/legal>
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.
From: haskell-cafe-bounces@haskell.org [mailto:haskell-cafe-bounces@haskell.org] On Behalf Of Alberto G. Corona
Sent: 22 October 2008 1:43 pm
To: haskell-cafe@haskell.org
Subject: [Haskell-cafe] Fwd: enhancing type classes with properties
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.
============================================================================== Please access the attached hyperlink for an important electronic communications disclaimer: http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html ==============================================================================