Bas van Dijk <v.dijk....@gmail.com> wrote:

> > My suggestion was to remove the generic Show instance and add only
> > specialized instances.  This is more work, but will also yield
> > better results.  In particular, it allows specialized string
> > representations for other types, too.
>
> What exactly is the problem with using OverlappingInstances to define
> specialized Show and Read instances for Vectors with certain element
> types (Char, Word8, Bool)?
>
> Am I missing something dangerous here?

Consider having the following instances:

    instance Show a => Show (Vector a)
    instance Show (Vector Word8)

How could the compiler determine, which instance you want, when saying

    show someVector

where someVector :: Vector Word8?  Both instances are valid here, and
there is no mechanism to choose one of them.  You can only write a
generic instance, where you can rule out the specialized instances.  I
don't think that's possible in this case.


Greets,
Ertugrul


-- 
nightmare = unsafePerformIO (getWrongWife >>= sex)
http://ertes.de/



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

Reply via email to