default roles

David Menendez dave
Thu Oct 10 17:14:36 UTC 2013


On Thu, Oct 10, 2013 at 12:11 PM, Simon Peyton-Jones
<simonpj at microsoft.com>wrote:

>  Does GND make sense in cases where the superclasses aren't also derived?
> If I had a type T whose Ord instance made use of the Eq instance for some
> reason, and then I made a newtype T' with a new Eq instance and a GND Ord
> instance, the calls to (==) in the Ord instance will refer to the T
> implementation, right?****
>
> ** **
>
> Yes, absolutely. ****
>
>           class Show a => C a where****
>
>             op :: a -> a****
>
> ** **
>
> You might want to use GND for the (C Age) instance, but NOT use GND for
> the Show instance.
>

Sure, but if op uses show internally, we get Int's show, not Age's, right?
That seems correct, in that it's doing what GND is supposed to do, but I'll
bet it will surprise people.

-- 
Dave Menendez <dave at zednenem.com>
<http://www.eyrie.org/~zednenem/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20131010/b4d5be5b/attachment.html>



More information about the Glasgow-haskell-users mailing list