Bob Hutchison | 8 Sep 21:08 2012
Picon

JavaScript (SpiderMonkey, V8, etc) embedded in GHC?

Hi,

I've looked around with no success… this surprises me actually. Has anyone embedded SpiderMonkey, V8,
or any other relatively decent JavaScript interpreters in GHC (using the FFI)?

I did find http://justinethier.github.com/husk-scheme/ which is a scheme R5RS implementation (I could
make this work). There's also some work done embedding Lua. I also found a number of packages that compile
javascript to Haskell, or the other way around, but I don't need that kind of thing.

All I really need is to allow users to write some JavaScript that accepts a single JSON 'file/string' from my
Haskell program and produces another JSON 'file/string' that my Haskell program will accept.

Thanks,
Bob
Greg Fitzgerald | 10 Sep 00:24 2012
Picon

Re: JavaScript (SpiderMonkey, V8, etc) embedded in GHC?

Hi Bob,


> All I really need is to allow users to write some JavaScript 
> that accepts a single JSON 'file/string' from my Haskell 
> program and produces another JSON 'file/string' that my 
> Haskell program will accept.

One option is to make your Haskell program an HTTP server, and then use Node.js to send and receive JSON files.



-Greg


On Sat, Sep 8, 2012 at 12:08 PM, Bob Hutchison <hutch-lists <at> recursive.ca> wrote:
Hi,

I've looked around with no success… this surprises me actually. Has anyone embedded SpiderMonkey, V8, or any other relatively decent JavaScript interpreters in GHC (using the FFI)?

I did find http://justinethier.github.com/husk-scheme/ which is a scheme R5RS implementation (I could make this work). There's also some work done embedding Lua. I also found a number of packages that compile javascript to Haskell, or the other way around, but I don't need that kind of thing.

All I really need is to allow users to write some JavaScript that accepts a single JSON 'file/string' from my Haskell program and produces another JSON 'file/string' that my Haskell program will accept.

Thanks,
Bob
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Bob Hutchison | 10 Sep 13:06 2012
Picon

Re: JavaScript (SpiderMonkey, V8, etc) embedded in GHC?

Thanks Greg, interesting thought. It would work the other way around, but it'd be easy enough to set up a node server to run the javascript. There's no IO allowed or any other blocking operations so I can make this all automatic. Still, that's another moving part I'd just as soon not have.

Strange there's no JavaScript embedding in GHC, or there doesn't seem to be.

Cheers,
Bob

On 2012-09-09, at 6:24 PM, Greg Fitzgerald <garious <at> gmail.com> wrote:

Hi Bob,

> All I really need is to allow users to write some JavaScript 
> that accepts a single JSON 'file/string' from my Haskell 
> program and produces another JSON 'file/string' that my 
> Haskell program will accept.

One option is to make your Haskell program an HTTP server, and then use Node.js to send and receive JSON files.



-Greg


On Sat, Sep 8, 2012 at 12:08 PM, Bob Hutchison <hutch-lists <at> recursive.ca> wrote:
Hi,

I've looked around with no success… this surprises me actually. Has anyone embedded SpiderMonkey, V8, or any other relatively decent JavaScript interpreters in GHC (using the FFI)?

I did find http://justinethier.github.com/husk-scheme/ which is a scheme R5RS implementation (I could make this work). There's also some work done embedding Lua. I also found a number of packages that compile javascript to Haskell, or the other way around, but I don't need that kind of thing.

All I really need is to allow users to write some JavaScript that accepts a single JSON 'file/string' from my Haskell program and produces another JSON 'file/string' that my Haskell program will accept.

Thanks,
Bob
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Simon Hengel | 10 Nov 20:39 2012
Picon

Re: JavaScript (SpiderMonkey, V8, etc) embedded in GHC?

Hi,

> I've looked around with no success… this surprises me actually. Has
> anyone embedded SpiderMonkey, V8, or any other relatively decent
> JavaScript interpreters in GHC (using the FFI)?

I just started something [1].

Cheers,
Simon

[1] https://github.com/sol/v8

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Claus Reinke | 10 Nov 22:40 2012

Re: JavaScript (SpiderMonkey, V8, etc) embedded in GHC?

>> I've looked around with no success… this surprises me actually. Has
>> anyone embedded SpiderMonkey, V8, or any other relatively decent
>> JavaScript interpreters in GHC (using the FFI)?
>
> I just started something [1].
>
> Cheers,
> Simon
>
> [1] https://github.com/sol/v8

Out of curiosity: wouldn't it make more sense to focus on the
other direction (calling Haskell from V8)? Roughly like:

- devices/GUI:
    Javascript/HTML/CSS in the browser/webview

- server/IO+lightweight computation:
    Javascript on node.js/V8

- server/computation+algorithms+parallelism+concurrency+..:
    Haskell on GHC

Also, if I recall correctly, the behind the scenes upgrade of
evented IO in GHC was never carried over to Windows.

Since node.js had to solve similar issues, and did so by using
libuv, perhaps there is an opening for completing the cross-
platform support for efficient evented IO in GHC, reusing
node's library-level efforts[1,2,3]? Just a thought..

Claus

[1] https://github.com/joyent/libuv
        "Its purpose is to abstract IOCP on Windows and
        libev on Unix systems."

[2] http://nikhilm.github.com/uvbook/introduction.html
        " libuv as a high performance evented I/O library
            which offers the same API on Windows and Unix."

[3] libuv - The little library that could (slides)
        http://www.2bs.nl/nodeconf2012/#1

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Simon Hengel | 13 Nov 08:34 2012
Picon

Re: JavaScript (SpiderMonkey, V8, etc) embedded in GHC?

> Out of curiosity: wouldn't it make more sense to focus on the
> other direction (calling Haskell from V8)? Roughly like:

I guess it really depends what you are after.  If you want to cabalize
existing JS libs, then I think bindings to V8 make perfect sense ;)

Cheers,
Simon
Bob Hutchison | 12 Nov 13:30 2012
Picon

Re: JavaScript (SpiderMonkey, V8, etc) embedded in GHC?


On 2012-11-10, at 2:39 PM, Simon Hengel <sol <at> typeful.net> wrote:

> Hi,
> 
>> I've looked around with no success… this surprises me actually. Has
>> anyone embedded SpiderMonkey, V8, or any other relatively decent
>> JavaScript interpreters in GHC (using the FFI)?
> 
> I just started something [1].
> 
> Cheers,
> Simon
> 
> [1] https://github.com/sol/v8

Nice! Thanks! I'll have a go with it today or tomorrow.
Simon Hengel | 13 Nov 10:29 2012
Picon

Re: JavaScript (SpiderMonkey, V8, etc) embedded in GHC?

> Nice! Thanks! I'll have a go with it today or tomorrow.

There is not much yet.  Have a look at the specs [1] to see what
currently works.

Cheers,
Simon

[1] https://github.com/sol/v8/tree/master/test/Foreign/JavaScript

Gmane