I'm quite new to Haskell and ghcjs. I'm starting with the very first "Hello, world!" program to learn.
Here is my Haskell program, copied from GHCJS wiki:
module Main where
main = putStrLn "Hello world!"
I use the command ghcjs -o hello hello.hs
to compile it to javascript, and I tried to run it on my Terminal with the command node hello.jsexe/all.js
, but when I tried to open the generated file "index.html":
<!DOCTYPE html>
<html>
<head>
<script language="javascript" src="rts.js"></script>
<script language="javascript" src="lib.js"></script>
<script language="javascript" src="out.js"></script>
</head>
<body>
</body>
<script language="javascript" src="runmain.js" defer></script>
</html>
But when I open this in Chrome the page is blank. Does anyone know what's wrong here?
putStrLn
outputs text to the Javascript console, which you can usually reach through the "developer tools" in your browser of choice. It does not generate any HTML.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With