Re: [Haskell-cafe] New demo/test program for Yhc Javascript backend

Fair enough, I can wait for a couple of days.
You might want to fix
thartman@none:~/haskell-installs/yhc-install/yhc/src/translator/js/test>darcs
whatsnew
{
hunk ./src/translator/js/test/Makefile 12
- $(YHC) -includes ../lib/haskell -linkcore $<
+ $(YHC) --includes ../lib/haskell --linkcore $<
}
immediately though.
This is the only makefile for the javascript stuff in the repo, and it
doesn't work because of - instead of --. Given your darcs log message
that the javascript compiler would be broken I initially assumed that
was the reason and not a flags change.
More questions. So okay, it builds, I have Test1.html. It's a blank
file with a bunch of javascript. I have firebug, so I can ask execute
stuff in the javascript console. But I can't figure out what to
execute. factorial isn't there, nor sumlst... none of the interesting
looking functions? So what is this supposed to do? And can I change
the makefile so that at least it generates javascript where I can
execute the interesting functions in the firebug console?
thomas.
2007/11/26, Dimitry Golubovsky
Thomas,
OK, let's try to get on the same page regarding where the project is.
The Javascript generator is maybe not optimal, but it works.
DOM bindings are generated from W3C's IDL files, so everything DOM provides may be used by Haskell programs, whether in CPS notation, or monadic, this will become clear, which form to use, in the near future.
The recent HsWTKDemo works well in major browsers (FF, MSIE, Opera) except for Safari, but this is probably a hard case due to the lack of debugging information.
If you look at its source http://darcs.haskell.org/yhc/web/jsdemos/HsWTKDemo.hs
(no, you cannot compile it at the moment because it is plain CPS) you may see some stuff related to static page layout definition in declarative way (look for upcntW, factW, etc.) This part is almost finalized wrt notation. What's left undecided is whether to use plain CPS notation, or monadic notation for parts of the code that involve imperative stuff (see e. g. updateD function where node's children are replaced in order to update what's displayed).
This all works perfectly in plain CPS. Understanding that nowadays Monads are mainstream, I am trying to adopt monadic notation based on the Cont monad instead of plain CPS. I ran one example (EchoM) on MSIE and noticed memory leaks on each user's action. However when the page is unloaded, MSIE shrinks in size which is a good sign. I think I know where the cause is, tonight I'll try to fix it. If unsuccessful, I'll probably unroll all monadic changes.
Next steps are:
1. Finalize the code notation for static layout and imperative part and check the base library into the Yhc repo
2. Generate haddock documentation
3. Write a better documentation for developers
4. Set up a web service that would allow everybody to submit their Haskell source and generate HTML page with Javascript in response; this I think can be done based on the hpaste program (backed by Happs).
Just for now, you have to wait a couple days while I am straightening the monadic thing out. I'd appreciate if you look at the code of HsWTKDemo and give me your impressions about notation, etc.
Thank you.
-- Dimitry Golubovsky
Anywhere on the Web
participants (1)
-
Thomas Hartman