Simon Peyton-Jones wrote:
Concerning (b) here's a suggestion.  As now, require that every instance 
requires an instance declaration.  So, in the main example of 
http://haskell.org/haskellwiki/Class_system_extension_proposal, for a new data 
type T you'd write
        instance Monad T where
          return = ...
          (>>=)  = ...

        instance Functor T
        instance Applicative T

Another alternative is to allow multiple classes in an instance declaration:

     instance (Monad T, Functor T, Applicative T) where
           return = ...
           (>>=)  = ...

The advantage is that this makes it more clear where the instances come from, especially if a class has multiple sub classes with different defaults. It also eliminates tricky issues with importing. Of course this needs some (albeit very little) new syntax.

I wrote a proposal a while ago, http://haskell.org/haskellwiki/Superclass_defaults

Twan
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to