hello, here is for the weekly bug :-) the program:
import Prelude(print) main = do print "hello" print "world"
works fine with hugs, but when executed with runhugs it fails with: runhugs: Error occurred ERROR - Undefined variable ">>" the do-notation translation should magically refer to the prelude and not what is in scope. i would have though that runhugs is reusing the same code as hugs... on a different matter: would it be possible to install some sort of a filter on the hugs-bugs list, there seems to be an awful lot of junk mail coming in thru' there. bye iavor
On Thu, May 15, 2003 at 11:29:24AM -0700, Iavor Diatchki wrote:
here is for the weekly bug :-) the program:
import Prelude(print) main = do print "hello" print "world"
works fine with hugs, but when executed with runhugs it fails with: runhugs: Error occurred ERROR - Undefined variable ">>"
the do-notation translation should magically refer to the prelude and not what is in scope. i would have though that runhugs is reusing the same code as hugs...
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 ()"));
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? bye iavor
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 ()"));
participants (2)
-
Iavor Diatchki -
Ross Paterson