Ahem.   Yes, that's a bug all right.   How embarassing.

I've fixed it, but won't be able to commit the fix till I get
back at the end of this week.  Meanwhile, use 'data' instead of
'newtype' as a workaround.

Thanks for reporting this, and for boiling it down to something small.

Simon

| -----Original Message-----
| From: Wolfgang Thaller [mailto:[EMAIL PROTECTED]] 
| Sent: 02 March 2002 22:20
| To: [EMAIL PROTECTED]
| Subject: Stack Overflow Panic
| 
| 
| I've checked out GHC 5.03 from CVS a few days ago
| and compiled it on my MacOS X machine. The compiler panics 
| with stack overflow on the following file:
| 
| \begin{code}
| module CrashingMonad where
| 
| data PPResult a = PPSuccess a PPState
| newtype PP a = PP (PPState -> PPResult a)
| 
| data PPState = PPState (PP ())
| 
| instance Monad PP where
| 
|       a >>= b = a `ppThen` b
| 
|       return x = ppReturn x
| 
| ppReturn x = undefined -- PP (\state -> PPSuccess x state)
| 
| (PP a) `ppThen` b = 
|       PP (\state -> case (a state) of
| 
|               PPSuccess x state' -> 
|                       undefined -- case (b x) of PP b' -> b' state'
|       )
|                                                       
| 
| test =        ppReturn 1 `ppThen` 
|               undefined -- ppReturn
| \end{code}
| 
| I don't think it's a problem with my MacOS X port,
| after all it compiled the library and some other modules of 
| my program without problems. Increasing the maximum stack 
| size only delays the panic. If I simplify the above module 
| any further, the panic goes away. (Replacing the "undefined"s 
| by the commented out expressions changes nothing).
| 
| There is no problem with ghc-5.02.2 on Intel. I cannot try it 
| out on ghc-5.03/intel due to lack of disk space.
| 
| Any Ideas?
| 
| 
| Wolfgang Thaller
| 
| -- 
| GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net
| 
| _______________________________________________
| Glasgow-haskell-bugs mailing list 
| [EMAIL PROTECTED] 
| http://www.haskell.org/mailman/listinfo/glasgow-| haskell-bugs
| 
_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to