Javascript with Haskell

Hello mailing list, I am developing a small text adventure game, which now runs nicely on a Linux terminal. I was going to ask a friend of mine to compile it on Windows, but then I thought: "Wouldn't it be awesome if people could run that in their browser?" I searched a bit and found this little example game [1]. As you can see it was written in Haskell but you can play it in your browser. Now, to the problem: it seems to me that the code requires UHC (Utrecht Haskell Compiler), which I don't have (I use GHC). What are the alternatives (if any)? As stated above, I am not going to code anything complex graphic wise, so the simpler the merrier! Thanks -F [1] http://jshaskell.blogspot.de/2012/09/breakout.html

Franco wrote:
Hello mailing list,
I am developing a small text adventure game, which now runs nicely on a Linux terminal. I was going to ask a friend of mine to compile it on Windows, but then I thought: "Wouldn't it be awesome if people could run that in their browser?"
I searched a bit and found this little example game [1]. As you can see it was written in Haskell but you can play it in your browser.
Now, to the problem: it seems to me that the code requires UHC (Utrecht Haskell Compiler), which I don't have (I use GHC). What are the alternatives (if any)? As stated above, I am not going to code anything complex graphic wise, so the simpler the merrier!
Well, a compiler like GHC turns Haskell code into machine code. You need a different compiler if you want to target JavaScript: GHCJS, haste or uhc are the currently available options. I myself am currently working on a GUI library called threepenny-gui [1] which uses the web browser as a display. However, while it does use the browser, it is currently not meant to be used over the internet, only locally. But maybe that would already be good enough for your purposes. [1]: http://www.haskell.org/haskellwiki/Threepenny-gui Best regards, Heinrich Apfelmus -- http://apfelmus.nfshost.com

There's actually some really good stuff for this now. I have experimented
a bit with haste. Cabal install it, then use the haste-inst to install
haskell libraries as javascript, then compile your program with it and then
load it into your browser. The only downside is that some lower level
functions don't work, so like I couldn't use the vector library in an
application I had already written. But if you keep that in mind while you
are developing it works pretty well. You should be able to do a text
adventure no problem.
There is also GHCJS which is set to release on the next ghc release (it
only works with new versions of ghc) which promises to go even further to
get those last few bits of code working. But of course it isn't out just
yet.
On Tue, Oct 8, 2013 at 4:30 PM, Franco
Hello mailing list,
I am developing a small text adventure game, which now runs nicely on a Linux terminal. I was going to ask a friend of mine to compile it on Windows, but then I thought: "Wouldn't it be awesome if people could run that in their browser?"
I searched a bit and found this little example game [1]. As you can see it was written in Haskell but you can play it in your browser.
Now, to the problem: it seems to me that the code requires UHC (Utrecht Haskell Compiler), which I don't have (I use GHC). What are the alternatives (if any)? As stated above, I am not going to code anything complex graphic wise, so the simpler the merrier! Thanks
-F
[1] http://jshaskell.blogspot.de/2012/09/breakout.html _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

On Wed, Oct 9, 2013 at 9:50 AM, David McBride
There's actually some really good stuff for this now. I have experimented a bit with haste. Cabal install it, then use the haste-inst to install haskell libraries as javascript, then compile your program with it and then load it into your browser. The only downside is that some lower level functions don't work, so like I couldn't use the vector library in an application I had already written. But if you keep that in mind while you are developing it works pretty well. You should be able to do a text adventure no problem.
There is also GHCJS which is set to release on the next ghc release (it only works with new versions of ghc) which promises to go even further to get those last few bits of code working. But of course it isn't out just yet.
Not for nothing, but they have a Vagrant build that makes it really easy to get up and running with GHCJS: http://www.reddit.com/r/haskell/comments/1fvv5q/ghcjs_introduction_concurren...
On Tue, Oct 8, 2013 at 4:30 PM, Franco
wrote: Hello mailing list,
I am developing a small text adventure game, which now runs nicely on a Linux terminal. I was going to ask a friend of mine to compile it on Windows, but then I thought: "Wouldn't it be awesome if people could run that in their browser?"
I searched a bit and found this little example game [1]. As you can see it was written in Haskell but you can play it in your browser.
Now, to the problem: it seems to me that the code requires UHC (Utrecht Haskell Compiler), which I don't have (I use GHC). What are the alternatives (if any)? As stated above, I am not going to code anything complex graphic wise, so the simpler the merrier! Thanks
-F
[1] http://jshaskell.blogspot.de/2012/09/breakout.html _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
participants (4)
-
David McBride
-
Franco
-
Heinrich Apfelmus
-
Patrick Mylund Nielsen