On Sat, Mar 22, 2014 at 8:38 PM, David Hall <d...@cs.berkeley.edu> wrote:

> On Sat, Mar 22, 2014 at 8:59 AM, Pascal Voitot Dev <
> pascal.voitot....@gmail.com> wrote:
>
> > The problem I was talking about is when you try to use typeclass
> converters
> > and make them contravariant/covariant for input/output. Something like:
> >
> > Reader[-I, +O] { def read(i:I): O }
> >
> > Doing this, you soon have implicit collisions and philosophical concerns
> > about what it means to serialize/deserialize a Parent class and a Child
> > class...
> >
>
>
> You should (almost) never make a typeclass param contravariant. It's almost
> certainly not what you want:
>
> https://issues.scala-lang.org/browse/SI-2509
>
> -- David
>

I confirm that it's a pain and I must say I never do it but I've inherited
historical code that did it :)

Reply via email to