Shapeless encodes double negation like so
type ¬[T] = T => Nothing
type ¬¬[T] = ¬[¬[T]]
that is
(T => Nothing) => Nothing
Miles explains
...the bottom type (Scala’s
Nothingtype) maps to logical falsehood... negation of a typeA(I’ll write it as¬[A]) to have as it's values everything which isn’t an instance ofA
Nothing is also used to represent non-termination, that is, computation that cannot produce a value
def f[T](x: T): Nothing = f(x)
Applying this interpretation to (T => Nothing) => Nothing, it seems to mean:
( T => Nothing ) => Nothing
Assuming a value of type T, then the program does not terminate, hence it never produces a value.
Is this intuition correct? Are concepts of falsehood and non-termination equivalent? If so, why having a program that does not produce a value, which does not produce a value, means we have a value of T?