fun deps and constraints in data decls
Iavor Diatchki
diatchki@cse.ogi.edu
Mon, 05 May 2003 11:47:09 -0700
> module Test where
Hello,
Both GHC and Hugs report an error on the example bellow,
which to me seems wrong. Is this a bug, or am I missing something?
> class C a b | a -> b
> newtype C a b => T a = T a
> t :: C a b => a -> T a
> t = T
The error reported is that "b" is an undefined type variable.
Since "a" determines "b" using the functional dependency,
I was expecting the example to work. I expected the type
of the data constructor "T" to be as the one given in the
type signature for "t", as I though that constraints on
data/newtype declarations simply were added to the constructors.
Both of the implementations are happy if I simply comment out the
constraint,
so they do not consider the type signature for "t" to be malformed in
any way.
bye
iavor