On 03/06/2012 11:38 PM, Christopher Done wrote:
I might as well chime in on this thread as it is relevant to my
interests. I made a write up on a comparison of HJScript (JavaScript
EDSL) and my Ji (control browser from Haskell) library:
https://github.com/chrisdone/ji

HJScript is "OK", hpaste.org uses it here:
https://github.com/chrisdone/amelie/blob/master/src/Amelie/View/Script.hs
output here: http://hpaste.org/js/amelie.js


HJScript (0.5.0) generates invalid Javascript if you try to use anonymous functions.

(Digs through email archives... Ah, yes:)

-------------------- snip --------------------
Given

> testJS :: HJScript ()
> testJS = do
>   f <- function (\(e :: JInt) -> do
>                     x <- inVar true
>                     return $ x)
>   callProc f (int 3)
>   return ()
>
> main :: IO ()
> main = do
>   putStrLn $ "JS: " ++ (show $ evalHJScript $ testJS)

We get the output

> function (param0_0){var var_1 = true;return var_1;}(3);

But this is invalid syntax in JavaScript, and should really be

> (function (param0_0){var var_1 = true;return var_1;})(3);

... which works.

-------------------- snip --------------------

Just something to be aware of.

(For my particular usage it was also too strictly typed, but that's another matter.)

Regards,


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to