[GHC] #1031: ghc 6.6 impossible happened
GHC
trac at galois.com
Tue Nov 28 21:24:49 EST 2006
#1031: ghc 6.6 impossible happened
-------------------------+--------------------------------------------------
Reporter: guest | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.6
Severity: normal | Keywords:
Difficulty: Unknown | Testcase:
Architecture: Unknown | Os: Unknown
-------------------------+--------------------------------------------------
{{{
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 #)
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1031>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list