Add instances for Nothing
What do you think about adding instances for Nothing like Eq, Ord, Semigroup?
I can submit a PR
Are you proposing adding them to alleycats or cats.core? I am asking because it seems to me that they have to be lawless instances right?
Some precedence: https://hackage.haskell.org/package/void-0.6.1/docs/Data-Void.html
What's the motivation? I'd be worried that those instances would increase the chances of unwanted nothings being inferred.
@kailuowang to cats.core, I believe they are completely legit since you can't ever produce a value of typeNothing.
@milessabin mainly because it is possible and Nothing is an important part of type theory. I am aware the compiler treats Nothing a bit differently but I can't tell if it would create any issue. I can think of some contrived examples where it could be used:
def foo[A: Eq](xs: List[A], ys: List[A]): Option[A] =
if(xs === ys) xs.headOption
else None
foo(Nil, Nil)
These can be useful for tests. E.g. in ZIO when creating an abstraction like class Foo[E, A: Eq](action: IO[E, A]), it is useful to test the cases when the action fails by passing in something like ZIO.fail("error"). Nothing pops up naturally here.