3 ms·
Fun fact, this also happens in Scala - try to List.contains an object from a type different than that stored in the list. Compiles, returns false always.
by blandflakes 5y ago
Fun fact, this also happens in Scala - try to List.contains an object from a type different than that stored in the list. Compiles, returns false always.
- chriswarbo 5y agoI actually encountered this in Scala (my example originally had [square brackets] rather than <pointy ones>). My `.has` method uses cats.Eq and is monkey-patched on to the Iterable interface: implicit final class IOps[A: cats.Eq](val i: Iterable[A]) { def has(x: A): Boolean = i.exists(_.eqv(x)) }
- blandflakes 5y agoHa, yup. We use the .contains_ method with cats eq on the objects, but this is clever.