
#12587: InstanceSigs doesn't work with ambigous types -------------------------------------+------------------------------------- Reporter: vagarenko | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 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: -------------------------------------+------------------------------------- Why this code: {{{#!hs {-# LANGUAGE ScopedTypeVariables, InstanceSigs, AllowAmbiguousTypes #-} module Bug where class Foo a class Bar a where bar :: forall b. (Foo b) => a instance Bar Int where bar :: forall b. (Foo b) => Int -- error here bar = undefined where x :: b x = undefined }}} is rejected with message: {{{ Error: * Could not deduce (Foo b0) from the context: Foo b bound by the type signature for: bar :: Foo b => Int at Bug.hs:11:12-35 The type variable `b0' is ambiguous * When checking that: forall b. Foo b => Int is more polymorphic than: forall b. Foo b => Int When checking that instance signature for `bar' is more general than its signature in the class Instance sig: forall b. Foo b => Int Class sig: forall b. Foo b => Int In the instance declaration for `Bar Int' }}} ? Where does `b0` type var come from? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12587 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler