
#7812: Ambiguity check too eager with unconstrained type variable ----------------------------------------+----------------------------------- Reporter: goldfire | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type checker) | Version: 7.7 Keywords: AmbiguityCheck | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: None/Unknown Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | ----------------------------------------+----------------------------------- Changes (by simonpj): * difficulty: => Unknown Comment: Unlike #7804, this one is by design. Suppose you said {{{ bar :: SBool b -> [F b a] bar = foo }}} You'd expect that to work, right? Same type signature! But it doesn't, even in 7.6: {{{ T7812.hs:17:7: Couldn't match type `F b a' with `F b a0' NB: `F' is a type function, and may not be injective The type variable `a0' is ambiguous Possible fix: add a type signature that fixes these type variable(s) Expected type: SBool b -> [F b a] Actual type: SBool b -> [F b a0] In the expression: foo In an equation for `bar': bar = foo }}} People complained about this, especially when they got an inferred type, tried to add it as a type signature, and had the program rejected. Your example is deeply strange too; if you put a singleton list you might well be stuck. And you could just make your type signature polymorphic in the list {{{ foo :: SBool b -> [c] }}} In short, I can't see how to help here. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7812#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler