Skip to content

ghc 6.6 impossible happened

ghc-6.6: panic! (the 'impossible' happened)
  (GHC version 6.6 for i386-unknown-linux):
        cgPanic
    tpl{v sVs} [lid]
    static binds for:
    main:Util.RWS.runRWS'{v rpz} [gid]
    main:Util.RWS.$f4{v rv4} [gid]
    main:Util.RWS.$f5{v rva} [gid]
    local binds for:
    SRT label main:Util.RWS.$f3{v ruN}_srt

the file which caused it is:

-- modification of Control.Monad.RWS to make it strict in its fields, as well as use unboxed tuples internally

module Util.RWS (
	RWS,
	module Control.Monad.Reader,
	module Control.Monad.Writer,
	module Control.Monad.State,
  ) where

import Prelude

import Control.Monad
import Control.Monad.Fix
import Control.Monad.Trans
import Control.Monad.Reader
import Control.Monad.Writer
import Control.Monad.State
import Data.Monoid



newtype RWS r w s a = RWS { runRWS' :: r -> s -> (# a, s, w #) }

runRWS x r s = case runRWS' x r s of
    (# a, b, c #) -> (a,b,c)

instance Functor (RWS r w s) where
	fmap f m = RWS $ \r s -> let
		(# a, s', w #) = runRWS' m r s
		in s' `seq` w `seq` (# f a, s', w #)

instance (Monoid w) => Monad (RWS r w s) where
	return a = RWS $ \_ s -> (# a, s, mempty #)
	m >>= k  = RWS $ \r s -> case runRWS' m r s of
		(# a, s',  w #) -> case runRWS' (k a) r s' of
                    (# b, s'', w' #) -> let w'' = w `mappend` w'
                        in w'' `seq` (# b, s'', w'' #)

--instance (Monoid w) => MonadFix (RWS r w s) where
--	mfix f = RWS $ \r s -> let (a, s', w) = runRWS (f a) r s in (a, s', w)

instance (Monoid w) => MonadReader r (RWS r w s) where
	ask       = RWS $ \r s -> (# r, s, mempty #)
	local f m = RWS $ \r s -> let r' = f r in r' `seq` runRWS' m r' s

instance (Monoid w) => MonadWriter w (RWS r w s) where
	tell   w = RWS $ \_ s -> (# (), s, w #)
	listen m = RWS $ \r s -> case runRWS' m r s of
            (# a, s', w #) -> (# (a, w), s', w #)
	pass   m = RWS $ \r s -> case runRWS' m r s of
		(# (a, f), s', w #) -> let w' = f w in w' `seq` (# a, s', w' #)

instance (Monoid w) => MonadState s (RWS r w s) where
	get   = RWS $ \_ s -> (# s, s, mempty #)
	put s = RWS $ \_ _ -> s `seq` (# (), s, mempty #)
                                                               
Trac metadata
Trac field Value
Version 6.6
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Unknown
Architecture Unknown
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information