[Haskell-cafe] Fwd: enhancing type classes with properties

Mitchell, Neil neil.mitchell.2 at credit-suisse.com
Wed Oct 22 10:07:28 EDT 2008

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.

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: haskell-cafe-bounces at haskell.org [mailto:haskell-cafe-bounces at haskell.org] On Behalf Of Alberto G. Corona 
	Sent: 22 October 2008 1:43 pm
	To: haskell-cafe at haskell.org
	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: 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20081022/380af8fd/attachment.htm

More information about the Haskell-Cafe mailing list