What are the use cases for Negated Givens in scala 3.0

Scala 3 introduces a new NotGiven type as mentioned @ Given Instances. I am finding hard to come up with an usecase for it. Can someone explain where such a construct will be useful?

1 Like

Being able to know that the compiler couldn’t find a typeclass instance for some type(s) can be very useful.

For example, to ensure two types are different with NotGiven[A =:= B]
To provide default behaviour if there is a more specific rule before like given deaultEncoder[A](using NotGiven[Encoder[A]]) as Encoder[A] with

In general, you can think of given values as logical proofs, as such NotGiven is the negation of such proof.