wartremover icon indicating copy to clipboard operation
wartremover copied to clipboard

type class implicit conversions trigger `ImplicitConversion`

Open sellout opened this issue 8 years ago • 3 comments

This is perhaps more of a question than an issue …

the ImplicitConversion wart triggers (understandably) on conversions used by type classes to “inject” operations. Wondering what the right approach is:

  1. @SuppressWarnings on those conversions,
  2. somehow get WartRemover to be able to differentiate those implicit conversions from other implicit conversions (this seems nice, but potentially impossible), or
  3. take some other approach to using type class operations.

I think the “issue” here is maybe adding something about this in the README.

sellout avatar Sep 21 '16 16:09 sellout

In my opinion, it is absolutely normal to disable the wart in this case.

Also see #242

tim-zh avatar Oct 24 '16 15:10 tim-zh

Personally I try to use implicit class in this case which should not trigger the wart. I do understand that there are limitations to this approach but I cannot think of a general rule that can identify "proper" implicit conversions that mimic implicit class.

ClaireNeveu avatar Oct 24 '16 16:10 ClaireNeveu

Somehow I missed these comments. Thanks for the clarification. I think the implicit class recommendation should be mentioned in the README (I’ll probably submit a PR for that shortly).

sellout avatar Jan 26 '17 18:01 sellout