title: 'idiomatic' Haskell type inequality
body: <p>(edited from previous question where I thought code below doesn't work)</p>
  
  <p>I wish to implement a haskell function f that has a restriction such that its 2 parameters must not have the same type. I have used the following code:</p>
  
  <pre><code>{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, UndecidableInstances, FlexibleInstances, FlexibleContexts, TypeFamilies, IncoherentInstances #-}
  data HTrue = HTrue
  data HFalse = HFalse
  
  class HEq x y b | x y -&gt; b
  instance (b ~ HTrue) =&gt; HEq x x b
  instance (b ~ HFalse) =&gt; HEq x y b
  
  
  g :: (HEq a b HFalse) =&gt; a -&gt; b -&gt; ()
  g x y = ()
  </code></pre>
  
  <p>Now the function g only accepts a and b if they have different types. Is this the 'idiomiatic' way to code type inequality in haskell? If not, what are the problems with it?</p>