So I recently read the following blow post: http://www.chuusai.com/2011/06/09/scala-union-types-curry-howard/
And I really appreciated the approach! I am trying to make a function
def neq[A,B] = ...
Where neq[String, String] would not compile, but neq[String, Int] would. It seems like this should be possible but I do not think I deeply enough understand the ways in which we can use curry-howard to encode logic in types.
My failed attempt follows:
I thought that what we wanted was essentially an Xor. So we want
A and ~B or ~A and B
Since all we have in scala when doing implicit resolution are things like <:<, =:=, I figure I need an implies in there, since that is <:<. So we say:
~(A and ~B) => (~A and B)
But if I try to do the following this doesn't work:
implicitly[((String with (Int => Nothing)) => Nothing) <:< ((String => Nothing) with Int)]
Which makes sense as the types don't match up at all. So I really am not sure where to go! Would love any guidance.