Is there some reason why this code is not compiled:
type family Foo a b :: Bool where
Foo a b = a == b
foo :: Foo a b ~ True => Proxy a -> Proxy b
foo _ = Proxy
bar :: Proxy a -> Proxy a
bar = foo
with error:
Couldn't match type ‘a == a’ with ‘'True’
Expected type: 'True
Actual type: Foo a a
but if I change type family definition to
type family Foo a b :: Bool where
Foo a a = True
Foo a b = False
it is compiled well?
(ghc-7.10.3)
==
defined? Is it lifted from instances automatically by GHC? If so, GHC has to account for the possibility of a weird instance where on some custom type(==) = \_ _ -> False
, I guess. – Dieterich(let x = 0/0 in x == x) ~> False
. – Jeffreyjeffreys