ghcjs / ghcjs

Haskell to JavaScript compiler, based on GHC
MIT License
2.61k stars 188 forks source link

Can ghcjs compile itself? #693

Open louisabraham opened 6 years ago

louisabraham commented 6 years ago

I would like to make a haskell interpreter in javascript. Has anyone attempted to compile ghcjs to js?

ddssff commented 6 years ago

My experience with ghcjs suggests to me that this would be extremely challenging at this time.

ryantrinkle commented 6 years ago

Luite has done it for one of his talks, but I'm not sure whether it still works or whether the performance is acceptable for real-world use.

On Mon, Sep 17, 2018, 04:19 David Fox notifications@github.com wrote:

My experience with ghcjs suggests to me that this would be extremely challenging at this time.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ghcjs/ghcjs/issues/693#issuecomment-421924287, or mute the thread https://github.com/notifications/unsubscribe-auth/ABGlYCOPW-PRiu_iArBPvO6Zw9D9o0WDks5ub1sUgaJpZM4WVimt .

mgsloan commented 6 years ago

I think that was compiling Fay, so still Haskell->JS in the browser. Would be super cool to see GHCJS self host!

chessai commented 5 years ago

@louisabraham something like code.world might be useful to look at; you can write a subset of Haskell therein.

cdsmith commented 5 years ago

@chessai @louisabraham You can write anything that GHCJS accepts at http://code.world/haskell, except for (a) no TemplateHaskell, and (b) available libraries include many widely used libraries, but not everything, and (c) projects must fit in one module (but @nomeata built https://github.com/nomeata/hs-all-in-one to consolidate multi-module projects into one module, if you are really desperate!).

It's worth noting that CodeWorld doesn't compile GHCJS for the browser, though; instead, it compiles on a server that I operate.