Say we have a function with signature
foo :: a -> b -> Int
Is it possible to enforce a constraint ensuring that a and b are different? That is
foo :: Int -> String -> Int -- ok
foo :: Int -> Int -> Int -- not ok
The purpose of this question is to learn more about Haskell and perhaps solve a design issue I'm facing. My particular case does not make sense if a == b, so I'd like to disallow that at the compiler level. I probably could make this issue go away with a different design altogether but that's besides the point now - the Pandoras box has been opened and I'd like to learn if an equality constraint on the type level is possible.