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