The Future of Haskell discussion at the Haskell Workshop

Robert Ennals Robert.Ennals@cl.cam.ac.uk
Wed, 10 Sep 2003 11:39:44 +0100


> On Wed, Sep 10, 2003 at 02:27:33PM +0200, Ketil Z. Malde wrote:
> > 
> > Shouldn't that rather be:
> > 
> >     class HasWibble a where
> >         wibble :: a -> Int
> >         set_wibble :: a -> Int -> a
> > 
> >     class HasWobble a where ...
> 
> Or even:
> 
>   class HasWibble a b | a -> b where
>       wibble :: a -> b
>       set_wibble :: a -> b -> a
>  
>   class HasWobble a b | a -> b where ...

It can be.

The programmer can declare the type classes however they like.

It is important to note that type classes are NOT automatically generated in 
my proposal. The type classes I describe are bog standard normal type classes.

The only magic takes place when records are made instances of type classes, at 
which point the fields are translated into default instances.


-Rob