Re: runhugs broken

Ross Paterson <[email protected]>
Newsgroups gmane.comp.lang.haskell.hugs.bugs
Message-ID <[email protected]>
On Thu, May 15, 2003 at 01:54:41PM -0700, Iavor Diatchki wrote:
> hello,
> 
> Ross Paterson wrote:
> >It's not the do-notation -- you get the same with
> >
> >>import Prelude(print)
> >>main = print "hello"
> >
> >The problem is the following line in runhugs.c:
> >
> >    hugs->pushHVal(hugs->compileExpr("Main","main >> return ()"));
> 
> aha, good point. so i chnaged
> "main >> return ()"
> to
> "main"
> and at least one example seems to work.  does the ">> return()" serve 
> any purpose?

It changes IO a to IO (), which is expected by doIO() aka DoIO().

But it's worse that that: even without the change, runhugs accepts

> main = []

and then dies with a runtime error.  There's no check that Main.main :: IO t.
An ugly fix (though it exacerbates your original bug) would be to change
that line to

    hugs->pushHVal(hugs->compileExpr("Main","main >> return () :: IO ()"));
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.