
On 08-Dec-2003, Christian Maeder
Fergus Henderson wrote:
I think the issue here is that in ghc (with -fglasgow-exts), the "a" here refers to the same type variable "a" in the top of the instance declaration, which has already been constained, and cannot be constrained again.
Is that a bug or a feature?
A feature. It's called "scoped type variables". See
http://www.haskell.org/ghc/docs/6.2/html/users_guide/type-extensions.html#SC...:
"The type variables in the head of a class or instance declaration scope
over the methods defined in the where part.".
Or were you referring to the fact that variables which are already
constrained can't be constrained again? IMHO that is a feature too.
It doesn't make sense to constrain a variable at any point other than
the point where that variable is introduced.
--
Fergus Henderson