GADTs and functional dependencies

Alfonso Acosta alfonso.acosta at
Tue Sep 23 12:44:11 EDT 2008

On Tue, Sep 23, 2008 at 6:36 PM, Wolfgang Jeltsch
<g9ks157k at> wrote:
> Pattern matching against the data constructor GADT specializes a to ().  Since
> Class uses a functional dependency, it is clear that b has to be ().

True, but it wont work if you provide () as the result and b in the
explicit signature. GHC is ranting with reason, the provided type, b,
does not match ().

On the other hand, this works:

fun :: (Class a b) => GADT a -> b
fun GADT = undefined

And as you stated, b can only be ()

More information about the Glasgow-haskell-users mailing list