On 2006-09-13, Ross Paterson <[EMAIL PROTECTED]> wrote:
> On Tue, Sep 12, 2006 at 08:59:30PM -0400, [EMAIL PROTECTED] wrote:
>> One of the proposals that comes up every so often is to allow the
>> declaration of a typeclass instance to automatically declare instances
>> for all superclasses.  So, for example:
>> 
>>     class (Functor m) => Monad m where
>>         fmap f m = m >>= return . f
>> 
>>     instance Monad Foo where
>>         return a = {- ... -}
>>         m >>= k = {- ... -}
>>         fail s = {- ... -}
>> 
>> This will automatically declare an instance of Functor Foo.
>> 
>> Similarly, a finer-grained collection of numeric typeclasses could
>> simply make Num a synonym for (Show a, Ord a, Ring a, Signum a).
>> Declaring an instance for (Num Bar) declares all of the other
>> instances that don't yet have a declaration.
>
> Such features would be useful, but are unlikely to be available for
> Haskell'.  If we concede that, is it still desirable to make these
> changes to the class hierarchy?

Absolutely.  It needs to be fixed, and much better now than later.

-- 
Aaron Denney
-><-

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

Reply via email to