Neil, Malcolm,
On 11/13/06, Neil Mitchell <
ndmitchell@gmail.com> wrote:
> Hi Dimitry,
>
> > > This demo page appears totally blank to me. (Using Safari under MacOS X
> > > 10.4.8). The Javascript console tells me there was a "Type Error line 1".
> >
> > I also received a message about some weird error in Opera.
>
> Under Opera its also blank to me (but an old version definately worked)
>
> The problem seems to be with this line (2620):
>
> var StdOverlay_46_95LAMBDA450=new HSFun("StdOverlay._LAMBDA450", 0,
> function(){return new String("function(x,y){return (x - (x %
> y))/y;}(exprEval(a),exprEval(b));");});
>
> Where as far as I can see a and b are undefined?
>
What you see indeed should not be there, but I don't know how to get rid of it.
There is the `unsafeJS' pseudo-function (indeed this is kind of a macro) which takes a string literal as an argument. The converter detects such function application and creates a wrapper which is used to call this code from Haskell.
So, x % y occurs in two places:
var Prelude_46Prelude_46Integral_46Prelude_46Int_46quot=new HSFun("Prelude.Prelude.Integral.Prelude.Int.quot", 2, function(v26142, v26143){return function(x,y){return (x - (x % y))/y;}(Number(exprEval(v26142)),Number(exprEval(v26143)));});
This is the inlining of the QUOT_W primitive.
var YHC_46Primitive_46primIntegerQuot=new HSFun("YHC.Primitive.primIntegerQuot", 2, function(a, b){
function(x,y){return (x - (x % y))/y;}(exprEval(a),exprEval(b));});