
#11608: Possible type-checker regression in GHC 8.0 when compiling `microlens` -------------------------------------+------------------------------------- Reporter: hvr | Owner: goldfire Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.0.1-rc2 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): Aha. In a class decl we use a `TyVar` (not a skolem `TcTyVar`) for the class variable(s). (There is a good reason for this: in the final `Class` value we don't want any `TcTyVar`s.) Then in `TcFlatten.flatten_tyvar` we see {{{ flatten_tyvar tv | not (isTcTyVar tv) -- Happens when flatten under a (forall a. ty) = flatten_tyvar3 tv }}} This case catches that class variable. In the ambiguity check for the type sig for `each` we have a Given equality for the class variable. Then, because of the above test we fail to take advantage of the Given. (And the error message too is misleading.) Solution: delete the above equation, so that we treat `TyVar` and skolem `TcTyVar` the same. I'm validating now. The `TyVar`/`TcTyVar` story is not great. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11608#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler