
#10722: GHC accepts "instance forall b. Blah []" -------------------------------------+------------------------------------- Reporter: osa1 | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.11 Resolution: invalid | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC accepts | Unknown/Multiple invalid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by simonpj): * status: new => closed * resolution: => invalid Comment: comment:1 isn't right: with `ScopedTypeVariables` the type variables mentioned the instance head are in scope in the instances (see [https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/other- type-extensions.html#cls-inst-scoped-tyvars the manual]). Eg {{{ instance Eq a => Eq [a] where (==) (x:xs) (y:ys) = (x::a) == y) && (xs::[a] == ys) }}} should work just fine. You don't even need a forall. (I will add a note to say this.) However the variable `b` is unused in instance head, and there is really no point in having it there; hence the message. If you have a use-case where you want an instance to be quantified over a type that is not mentioned in the instance head, I'd be glad to see it. Meanwhile I'll mark this as invalid. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10722#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler