[Haskell-cafe] in-equality type constraint?

wren ng thornton wren at freegeek.org
Sat Jul 17 03:14:36 EDT 2010


Christopher Lane Hinson wrote:
> On Fri, 16 Jul 2010, Paul L wrote:
> 
>> Does anybody know why the type families only supports equality test
>> like a ~ b, but not its negation?
> 
> I would suggest that type equality is actually used for type inference,
> whereas proof of type inequality would have no consequence (that I can 
> think of) for the compiler.

Also, it's a lot easier to solve a system of constraints when you only 
have positive constraints. Adding negative constraints greatly 
complicates the solver. In many cases it's still doable, though the 
structure of types might pose some additional challenges above the usual 
ones.

(And they're usually called "disequality" constraints, since 
inequalities are only interesting when you have subtyping.)

-- 
Live well,
~wren


More information about the Haskell-Cafe mailing list