-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unclear how to start tutorial example #21
Comments
You need to compile code with GHCJS first and copy produced To make this work with stack you may need something similar in your setup-info:
ghcjs:
source:
ghcjs-0.2.0.20160414_ghc-7.10.3:
url: https://s3.amazonaws.com/ghcjs/ghcjs-0.2.0.20160414_ghc-7.10.3.tar.gz
sha1: 6d6f307503be9e94e0c96ef1308c7cf224d06be3 If I'm not mistaken with this config you'll be able to install GHCJS first by running To ease the development process I usually write a shell script to build project with GHCJS first, update (move) resulting JSEXE folder to static directory, then build project with GHC and finally run the application. Note, that application should ask you what to do and which port to use, to avoid manual typing you can pass Hope this helps. |
I tried that, but now I get this error:
This is my app/Main.js: https://gist.github.com/ysangkok/60d57e67713ac67427306230532a472c I don't know how to proceed. Thanks for your help. |
Hi,
Due to the overloadedString all literal string has now a polimorphic type. "Hi!" is disambiguated to String, since the second line concatenate with (++) what was returned by wlink, which is the first parameter "Hi!" But
is ambiguous, since toElem belongs to a class that has many types. to disambiguate avoid OverloadedString, and use fromString (from Data.String) for conversion from String to another type. or use
|
Ok, I got it running by removing OverloadedStrings, changing fromStr to fromString and adding the import. But when I browser the page on localhost:8081, the JavaScript console reports |
Hi Janus: the reason is because unlike haplayground, that renders the widgets using his own monad,, ghcjs-hplay need to use a "render" primitive explicitly: Note the
Note that I do not include render must be put in each monadic sentence that has widgets to produce dynamic updates when events happens. For static rendering, a single render at the beginning may suffice. But this is rarely the case. |
Nice, thanks, finally works! |
After removing the n (#20) I start the server using
stack runghc app/Main.hs
. I open my browser at localhost:8081, and it says it can't find Index.html (I wrote a comment on a commit for that). How do I launch the example from the bottom of the tutorial?The text was updated successfully, but these errors were encountered: