[Haskell-cafe] ANNOUNCE: vector-bytestring-0.0.0.0
Ertugrul Soeylemez
es at ertes.de
Sat Oct 15 23:17:04 CEST 2011
Bas van Dijk <v.dijk.bas at 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/
More information about the Haskell-Cafe
mailing list