
#7729: GHC panics. Invalid core ---------------------------------+------------------------------------------ Reporter: Khudyakov | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.2 Keywords: | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: None/Unknown Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | ---------------------------------+------------------------------------------ Changes (by simonpj): * difficulty: => Unknown Comment: Interesting. With HEAD we get {{{ T7729.hs:29:14: Could not deduce (BasePrimMonad (Rand m) ~ t0 (BasePrimMonad (Rand m))) from the context (PrimMonad (BasePrimMonad (Rand m)), Monad (Rand m), MonadPrim m) bound by the instance declaration at T7729.hs:26:10-42 The type variable ‛t0’ is ambiguous Expected type: t0 (BasePrimMonad (Rand m)) a -> Rand m a Actual type: BasePrimMonad (Rand m) a -> Rand m a Relevant bindings include liftPrim :: BasePrimMonad (Rand m) a -> Rand m a (bound at T7729.hs:29:3) In the first argument of ‛(.)’, namely ‛liftPrim’ In the expression: liftPrim . lift In an equation for ‛liftPrim’: liftPrim = liftPrim . lift }}} If you change the offending line to {{{ liftPrim x = liftPrim (lift x) }}} then we get a different erro rmessage {{{ Adding error: T7729.hs:28:31: Occurs check: cannot construct the infinite type: m0 ~ t0 m0 Expected type: m0 a Actual type: BasePrimMonad (Rand m) a In the first argument of ‛lift’, namely ‛x’ In the first argument of ‛liftPrim’, namely ‛(lift x)’ In the expression: liftPrim (lift x) }}} Although these errors look different, they are acutally pretty similar. GHC 7.6.2 fails to reject the program, but gives a Lint error if you use `-docore-lint`. I don't propose to try to fix this... too obscure. I'll add a regression test thought. Thank you for the example. Simon -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7729#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler