Hi Alberto,
Take a look at ESC/Haskell and Sound Haskell, which provide mechanisms for
doing some of the things you want. I don't think they integrate with type
classes in the way you mention, but I think that is just a question of syntax.
http://www.cl.cam.ac.uk/~nx200/
Thanks
Neil
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
<outbind://4/www.credit-suisse.com/emea/legal> >
________________________________
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alberto
G. Corona
Sent: 22 October 2008 1:43 pm
To: [email protected]
Subject: [Haskell-cafe] Fwd: enhancing type classes with properties
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.
==============================================================================
Please access the attached hyperlink for an important electronic communications
disclaimer:
http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
==============================================================================
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe