<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hello,<div><br></div><div>This solution sounds like it has the server making a lot of the choices about how to modify the DOM. But it seems like that pushes a lot of work onto the server instead of spreading it out to the clients. Aside from driving up your server bandwidth/CPU usage, it seems like it would also incur more latency than doing the working on the client side?</div><div><br></div><div>That said, HSX can be parameterized to turn the literal XML into output in different ways by using different monads. So, if you write:</div><div><br></div><div>fragment :: (XMLGenerator m) =&gt; m (HSX.XML m)</div><div>fragment = &lt;p&gt;hello, world&lt;/p&gt;</div><div><br></div><div>If you use the HSP monad, it will construct a value of type:</div><div><br></div><div>data XML = Element Name Attrs [Element] | CDATA Bool String</div><div><br></div><div>But if you use it with the HJScript monad, it will actually generate javascript code which creates the XML on the client.</div><div><br></div><div>So, that might be a start..</div><div><br></div><div>- jeremy</div><div><br></div><div><br><div><div>On Jun 22, 2010, at 10:27 AM, Alberto G. Corona wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">I forgot to cc this to the list. sorry<br><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Alberto G. Corona</b> <span dir="ltr">&lt;<a href="mailto:agocorona@gmail.com">agocorona@gmail.com</a>&gt;</span><br> Date: 2010/6/22<br>Subject: Re: [web-devel] missing web component needed: server-side page control<br>To: Michael Snoyman &lt;<a href="mailto:michael@snoyman.com">michael@snoyman.com</a>&gt;<br><br><br>Hi Michael,<div>Great to know that you are interested!.</div> <div><br></div><div>Good to know that you are working on widgets. Iīm thinking about the same idea, but I ephasize the dynamic nature, that is , not only the widgets could be populated from haskell data structures, but will use the server side control to make them dynamic, so they can &nbsp;interact with haskell server code without refreshing the whole page.</div> <div><br></div><div>I tough on the need of an HTML DOM, because in my view, &nbsp;we need a 1:1 mapping between the browser and the server in &nbsp;XML manipulation primitives.&nbsp;Because Javascript uses HTML DOM. Much of HTML DOM methods are a single call to the corresponding XML DOM in HXT. But some other, like style manipulation are different.&nbsp;</div> <div><br></div><div>My idea is to have in the server a copy of the HTML tree. Any modification on the server will be forwarded to the client. &nbsp;For example, the innerHTML method should be executed in the server as such:</div> <div><br></div><div>setInnerHTML element text=&nbsp;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; modify the local XML element with XML DOM</div><div>&nbsp;&nbsp; &nbsp; &nbsp; if does not exist, exception raised</div><div>&nbsp;&nbsp; &nbsp; &nbsp; if success, add "element.innerHTML= text" to the Ajax queue (the javascript listener will eval(uate) it in the client</div> <div><br></div><div>having a local XML tree copy permits not only checking for errors in the server but also to query for document properties. referential transparency permits to share the unmodified XML branches for many client sessions. But I donīt went deep on thinking about it. neither I know the technology used in <a href="http://ASPX.NET" target="_blank">ASPX.NET</a> of JavaServer Faces to do server control. It is really difficult to guess it doe to the confusing documentation. I can only guess &nbsp;from the functionalities. &nbsp;</div> <div><br></div><div>Maybe we have to do a research on the best way to communicating client and server for server control, the methods to be used etc...</div><div><br></div><div><br></div><div><br></div><div><div class="gmail_quote"> 2010/6/22 Michael Snoyman <span dir="ltr">&lt;<a href="mailto:michael@snoyman.com" target="_blank">michael@snoyman.com</a>&gt;</span><div><div></div><div class="h5"><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <div dir="ltr">Sounds interesting. I just released Yesod 0.3.0, and had in mind that 0.4.0 will focus on a concept I was calling widgets. It sounds very similar to what you're talking about here, so I would definitely be interested in collaborating with you.<div> <br></div><div>I'm not sure if writing DOM manipulation code ourselves is necessarily the right approach. It might make more sense to simply leverage an existing Javascript library (my personal preference being jQuery).</div> <div><br></div><div>I have to get back to "real work" for the rest of the day, but I'd like to hear any other thoughts you have on the subject.</div><div><br></div><div>Michael<br><br><div class="gmail_quote"> <div><div></div><div> On Tue, Jun 22, 2010 at 2:23 PM, Alberto G. Corona <span dir="ltr">&lt;<a href="mailto:agocorona@gmail.com" target="_blank">agocorona@gmail.com</a>&gt;</span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <div><div></div><div> Hi web haskellers.<br> A few days ago I mention the need to have &nbsp;server-side page control<br> available in Haskell. <a href="http://ASP.NET" target="_blank">ASP.NET</a> and JavaServer Faces have it.<br> I would like to collaborate with anyone of you interested. I have not<br> much time now but this can change in the coming weeks so I want to<br> know the interest on the subject in advance. I also want to receive<br> comments to the development plan.<br> <br> The main advantages are:<br> &nbsp;&nbsp;-No Javascript, no Ajax needed when developing dynamic HTML pages<br> (All code becomes pure haskell in the server!!)<br> <br> &nbsp;-No errors in advanced dynamic HTML code: all is statically typed<br> haskell (someone bets more?)<br> <br> &nbsp;&nbsp;-Clear separation of HTML presentation from page control code<br> <br> &nbsp;&nbsp;-Extensibility: makes possible to create custom controls, like HTML<br> tables automatically generated from haskell containers etc<br> <br> All this will unleash the full power of haskell in the Web!!!<br> <br> It is compatible and orthogonal with page templating and all other web<br> stuff. I think that it is a &nbsp;two month work.<br> <br> basically what we have to do is the following:<br> <br> &nbsp;&nbsp;0 develop a Haskell HTML DOM library. Just 31 objects to manage HTML trees<br> &nbsp;&nbsp; &nbsp; See the&nbsp;HTML DOM Objects Reference at<br> <a href="http://www.w3schools.com/jsref/default.asp" target="_blank">http://www.w3schools.com/jsref/default.asp</a><br> &nbsp;&nbsp; &nbsp; &nbsp;I suppose that this is not yet done<br> &nbsp; &nbsp; &nbsp;Can make use of the XML structure defined in HXT<br> <a href="http://hackage.haskell.org/package/hxt-8.5.2" target="_blank">http://hackage.haskell.org/package/hxt-8.5.2</a>. HXT has namespace<br> &nbsp; &nbsp; &nbsp;support. This is needed for defining custom attributes and tags (4 and 5).<br> <br> &nbsp; &nbsp; each HTML DOM method will do two basic things:<br> &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;a) update a copy of the HTML page tree in the SERVER<br> <br> &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;b) send trough an Ajax channel the equivalent javascript<br> method, that will be executed in the web browser<br> <br> &nbsp;&nbsp; 3 create a minimum javascript module that:<br> &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;read Ajax responses and execute them in the web browser, for<br> the above functionality<br> &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;listen for events and forward them to the server trough Ajax.<br> <br> &nbsp;&nbsp; 4 define additional XML attributes to be interspersed in the HTML tree for<br> &nbsp;&nbsp; &nbsp; &nbsp; specifying url' s in the server where the server events will be<br> forwarded &nbsp;(for 3)<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;button server:onclick="<a href="http://server/path.." target="_blank">http://server/path..</a>."&gt;<br> <br> &nbsp;&nbsp; 5 a mechanism for defining custom XML tags for extensibility: with<br> the name, the parameters and the library code that handle it<br> &nbsp; &nbsp; &nbsp;example of custom tag inserted in the HTML: &lt;t:table<br> t:source="#{hasjkelldata} param1=......&gt;<br> <br> &nbsp; 6 some templating that read 5 and produces a HTML tree and Haskell code.<br> <br> <br> So, people, feel free to question anything. This is just the starting<br> point to put ideas in the table and discuss all of this<br></div></div> _______________________________________________<br> web-devel mailing list<br> <a href="mailto:web-devel@haskell.org" target="_blank">web-devel@haskell.org</a><br> <a href="http://www.haskell.org/mailman/listinfo/web-devel" target="_blank">http://www.haskell.org/mailman/listinfo/web-devel</a><br> </blockquote></div><br></div></div> </blockquote></div></div></div><br></div> </div><br> _______________________________________________<br>web-devel mailing list<br><a href="mailto:web-devel@haskell.org">web-devel@haskell.org</a><br>http://www.haskell.org/mailman/listinfo/web-devel<br></blockquote></div><br></div></body></html>