[GHC] #10176: Invalid core generated with GHC 7.10 RC3

GHC ghc-devs at haskell.org
Sat Mar 21 15:23:25 UTC 2015


#10176: Invalid core generated with GHC 7.10 RC3
-------------------------------------+-------------------------------------
        Reporter:  NeilMitchell      |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  high              |               Milestone:  7.10.1
       Component:  Compiler          |                 Version:  7.10.1-rc3
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  None/Unknown      |  Unknown/Multiple
      Blocked By:                    |               Test Case:
 Related Tickets:                    |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by nomeata):

 I simplified your code slightly, removing everything about type classes:

 {{{

 module Buggy(buggy) where

 import Errors

 newtype ReaderT r a = ReaderT { runReaderT :: r -> IO a }

 p = liftReaderT (return ())

 m >>> k = ReaderT $ \r -> do runReaderT m r; runReaderT k r

 liftReaderT :: IO a -> ReaderT r a
 liftReaderT m = ReaderT (const m)

 {-# NOINLINE buggy #-}
 buggy :: (() -> Bool) -> () -> Bool -> IO ()
 buggy fun unit bool =
     runReaderT (
         (if bool then liftReaderT $ print () else p)
         >>>
         (if fun unit then error2Args unit unit >>> p else p)) ()
 }}}
 still exhibits the problem. Removing the `newtype`, or turning it into a
 `data` makes the problem go away.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10176#comment:13>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list