Thanks for the report.  It's a known bug in 5.04, will be fixed in
5.04.1 (which is imminent)

Simon

| -----Original Message-----
| From: Mark Tullsen [mailto:[EMAIL PROTECTED]]
| Sent: 10 September 2002 19:47
| To: [EMAIL PROTECTED]
| Subject: infinite loop in ghc5.04
| 
| When I attempt to compile the following code with ghc 5.04
| 
|      newtype Server i o = Server (i -> (o, Server i o))
| 
|      machine :: s -> ((i,s) -> (s,o)) -> Server i o
|      machine init next = Server (f init)
|        where
|        f s i = (o, Server (f s'))
|                where
|                (s',o) = next (i,s)
| 
| I get the following
| 
|    $ ghc -c T.hs
|    stack overflow: use +RTS -K<size> to increase it
| 
|    $ ghc -c T.hs +RTS -K10m
|    stack overflow: use +RTS -K<size> to increase it
| 
|    $ ghc -c T.hs +RTS -K20m
|    stack overflow: use +RTS -K<size> to increase it
| 
|    ...
| 
| But if I transform the program to the equivalent
| 
|      newtype Server i o = Server (i -> (o, Server i o))
| 
|      machine :: s -> ((i,s) -> (s,o)) -> Server i o
|      machine init next = Server (f next init)
| 
|      f next s i = (o, Server (f next s'))
|        where
|        (s',o) = next (i,s)
| 
| ghc compiles without a problem.  Changing 'newtype' to 'data'
| also makes the problem go away.  This is on a Linux (RH 7.3)
| machine with an i686 processor.
| 
| Thanks.
| 
| - Mark
| 
| _______________________________________________
| 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