runhugs broken

Ross Paterson ross@soi.city.ac.uk
Thu, 15 May 2003 23:27:26 +0100


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 ()"));