[Haskell-cafe] Re: A GHC error message puzzle

Jason Dagit dagit at codersbase.com
Thu Aug 12 16:28:22 EDT 2010


On Thu, Aug 12, 2010 at 1:25 PM, Wei Hu <wei.hoo at gmail.com> wrote:

> Anyone care to explain why? I also tested a slightly changed program
> pasted below, and am very confused.
>
> > main = do
> >   -- This call doesn't terminate, why?
> >   print $ nonTermination "a"
> >   -- Comment the above line to test the rest of the code
> >   -- RTS detects the loop and bails out
> >   print $ process "abc"
> >   -- Comment the above line to test the rest of the code
> >   inp <- readFile "input"
> >   -- I'm guessing (process inp) throws an exception,
> >   -- and the handler closes all files, making a second close fail?
> >   writeFile "output" $ process inp
>
> > process :: String ->  String
> > process xs = blackhole where blackhole = tail blackhole
>
> > nonTermination :: String -> String
> > nonTermination _ = blackhole where blackhole = blackhole
>

If you compile the program to use the non-threaded RTS does the behavior
change?

Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100812/c890b312/attachment.html


More information about the Haskell-Cafe mailing list