'Convertible' class?

Dylan Thurston dpt@math.harvard.edu
Wed, 7 Feb 2001 17:43:40 -0500


On Wed, Feb 07, 2001 at 10:19:33PM +0100, Hannah Schroeter wrote:
> Hello!
> 
> On Wed, Feb 07, 2001 at 03:43:59PM -0500, Dylan Thurston wrote:
> > In thinking about various issues with the numeric classes, I came up
> > with the following question:  Is there a problem with having a class
> > 'Convertible' as follows?
> 
> > class Convertible a b where
> >     convert :: a -> b
> 
> > [...]
> 
> Why not better:
> 
> class Subtype a b where {- a is subtype of b, if following operations exist -}
> 	inject :: a -> b
> 	project :: b -> Maybe a

Shouldn't this be a subclass?  'project' is not always easy or
possible to define.

Best,
	Dylan