#7264: Adding GHC's inferred type signatures to a working program can make it fail with Rank2Types ------------------------------------------+--------------------------------- Reporter: guest | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.4.1 Resolution: fixed | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Difficulty: Unknown Testcase: typecheck/should_fail/T7264 | Blockedby: Blocking: | Related: ------------------------------------------+--------------------------------- Changes (by simonpj):
* status: new => closed * testcase: => typecheck/should_fail/T7264 * resolution: => fixed Comment: Now GHC does not instantiate `mmap` at a polymorphic type, and we get this error message from the program without the type signature {{{ T7264.hs:11:19: Couldn't match type `a' with `forall r. r -> String' `a' is a rigid type variable bound by the inferred type of mkFoo2 :: a -> Maybe Foo at T7264.hs:11:1 Expected type: a -> Foo Actual type: (forall r. r -> String) -> Foo Relevant bindings include mkFoo2 :: a -> Maybe Foo (bound at T7264.hs:11:1) val :: a (bound at T7264.hs:11:8) In the first argument of `mmap', namely `Foo' In the expression: mmap Foo (Just val) In an equation for `mkFoo2': mkFoo2 val = mmap Foo (Just val) }}} It's not a fantastic message, but it's on the money, and (without `-XImpredicativeTypes`) the program should certainly be rejected. Simon -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7264#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs