Hi Jeremy,
I'm not sure I understand - I see nothing wrong with the output.
What's the error again?
Btw, is the Web monad something to do with happs-hsp? I haven't had a
chance to look at that closely yet, but it seems promising.
Cheers,
/Niklas
> Here is my understanding. In the xhtml spec, appendix C, there are
> guidelines for creating xhtml documents which can be parsed as valid
> html.
>
> http://www.w3.org/TR/2000/REC-xhtml1-20000126/#guidelines
>
> One of the requirements is that an empty script tag must be rendered
> as:
>
> <script></script> instead of <script />
>
> The restriction applies to a number of other elements, such as
> <textearea>, <title> and <p>.
>
> However, it appears to me that hsp always minimizes elements when
> possible -- and therefore is not html backwards compatible.
Sigh. :-)
Don't you just hate it when they have to go and mess up a good idea
with legacy like that? The whole point of switching from HTML to XHTML
was that everything should be uniform! You can't make things uniform,
and then say they shouldn't be uniform after all. Double sigh. ;-)
> One fix is to modify happs-hsp so that it serves the pages with the
> mime-type, 'application/xhtml+xml' instead of 'text/html'.
I like this. Sounds like The Right Thing To Do.
> Unfortunately, this has some major drawbacks -- for example, IE 6 does
> not support application/xhtml+xml. Also, javascript for xhtml is
> different in someplaces.
This sounds like something I would care less about. I'm sure that
there are some who care about total backwards compatibility, but I'm
frankly not one of them. The fact that document.write no longer exist
is to me a BIG PLUS, since the whole idea behind HSP is to get away
from treating the page as an output stream of characters. And our
nifty literal syntax used in client-side code should take care of all
the hassle. Etc...
(Yes, I know I live in an idealized world, but so be it ;-))
I read that page you linked to, and I can't help notice that it's from
2003. Sure, some still use IE 6 of course - but the less pages IE 6
can serve, the faster it will disappear for good. IE 6 is pure evil.
That said, if someone were to send a patch to hsp that adds a
renderAsLegacyHTML :: XML -> String function, I would of course apply
it. Or if someone were to make a really good case for it (such as
promising to use HSP in a large-scale public application if this
existed), I might even write it myself. ;-)
> HSP is, to a degree, in no man's land right now.
> It does not generate backwards compatible html, and none of the
> examples are valid xhtml. For them to be valid xhtml, they need to
> open with something like:
>
> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
>
> instead of plain old:
>
> <html>
>
> because, xmlns is a required attribute. Without it, firefox (and
> possibly other browsers) will treat the document as a plain old xml
> document instead of xhtml.
Hmm, that's interesting, and definitely a problem - and not too hard
to fix I guess. The literal syntax even supports passing a list of
extra attributes, so I guess we could define e.g.
reqHtmlAts = ["xmlns" := "http://www.w3.org/1999/xhtml",
("xml", "lang") := "en", "lang" := "en"]
and use that like
page = <html reqHtmlAts>... </html>
I guess that will go in the HSX.XHTML module, once I get it completed.
This weekend seems like a good target, but I've said that for three
weeks now... The combinators in HSX.XHTML that generate elements will
of course do that automatically.
> HAppS+HSP is nice, because it forces you to keep the business logic
> and display layer separate. The syntax and power of HSP blow xslt
> away. Plus, you get the advantages of type checking, etc. Also, HAppS
> uses HSP by compiling the pages and loading them via hs-plugins. It
> uses inotify to automatically determine when the pages have changed.
> So, my changes are compiled and loaded before I even have time to
> switch to the web browser.
You can't even begin to imagine how happy it makes me to hear you say
this, that you like it! :-)))
I've seen the first versions of happs-hsp but I haven't gotten to use
the later versions that Lemmih have done. But from what you say, it
truly sounds like it's nice and easy to work with, just like we've
always envisioned!
Please keep on reporting the ups and downs of your experiences, so we
can keep improving our system! :-)
Cheers,
/Niklas
I've been so sure for so long that XHTML is the future, but it seems I
may have to reconsider. And if XHTML is not the future, then we need
to make sure that we support whatever is.
Where do we start? :-)
I guess an easy starting point is to write the renderAsHTML
(renderAsTagsoup?) function that takes care to be compatible as
specified in Appendix C. That would go a long way towards supporting
"reality", right?
In fact, since we never need to bother about actually *parsing* the
tagsoup, we don't need to care so much that the beautifully simple XML
model will be replaced by an ugly beast of HTML5 tagsoup (but inside I
cry blood).
We should of course continue to support XML in general, as well as
XHTML specifically. But if the DOM is different in XHTML and HTML,
exactly *how* we support HJScript for both is not quite so clear. Any
good suggestions on that? What are the major differences here?
Also, there is absolutely no reason why our own syntax should not
continue to be XML. In fact, that's the only way we could ever hope to
mix XML syntax and Haskell code. But that doesn't mean we have to
render it the same way we write it of course.
Cheers,
/Niklas
>
> > We should of course continue to support XML in general, as well as
> > XHTML specifically. But if the DOM is different in XHTML and HTML,
> > exactly *how* we support HJScript for both is not quite so clear. Any
> > good suggestions on that? What are the major differences here?
>
> Right. I think the differences mostly revolve around what methods and
> properties are available. As I suggested in a different thread, we
> might be able to do something with type classes to indicate what
> environments support which methods/properties. I need to do more
> research on this still.
Maybe it's possible to find a nice way of encoding this using type
classes and if done properly it sure would be a cool feature. On the
other hand I think it's of great importance to keep the core
interfaces as simple as possible.
The simplest approach would be to provide DOM methods, even the ones
not supported by all browsers/standards, leaving it the user to decide
which platform to support. In some sense this would be analogues to
the HSP XML type that guarantees that the generated XML is well formed
but not that it's actually valid HTML/XHTML.
Another possibility (I've talked about it before) is to create wrapper
methods to some (suitable) third part JavaScript library letting it
take care of the browser/standard issues.
Off course all ideas are worth exploring and can co-exist in different
libraries. The main battle I guess is of how to design the core
library.
On a completely different subject, since you are using HAppS, have you
experimented with the HAppS-IxSet and if so, do you think it's
comparable to using relational data bases? What I'm really asking is
if non-trivial data base driven applications could be "easily" ported
to HAppS removing the need of an external data base server? (Just out
of curiosity).
- Joel
I'm of the same mind. While I think it would be possible to code this
up with type classes, I don't see it as desirable. I'd rather take an
approach similar to ByteString, i.e. having different versions with
identical interfaces and just switch between them using different
imports. We would of course not have *exactly* identical interfaces,
only for the parts that are common to both worlds. The rest would live
in one module or the other, and you'd get type errors if you tried to
use e.g. document # applets while using the xhtml module. So in a
sense you'd get the best of type classes without cluttering up the
interface.
> Another possibility (I've talked about it before) is to create wrapper
> methods to some (suitable) third part JavaScript library letting it
> take care of the browser/standard issues.
I think we could have that too, and I think that will be an important
part of HSP development, but I would prefer to have the core HJScript
support all the basics for the quick and dirty hacks. ;-)
Cheers,
/Niklas
- Joel