Published on August 9, 2010 under the tag haskell
Internally, most of it has been rewritten. The big advantage of our new internal system is that we can now support different backends, without losing any speed. We support the following backends for now:
Text.Blaze.Renderer.Utf8: The default, fast UTF-8 renderer which produces a lazy
Text.Blaze.Renderer.String: A renderer which renders the page to a
String. This renderer is optimized as well, but of course, not as fast as the
Text.Blaze.Renderer.Pretty: A variation of the
Stringrenderer which produces a prettified, well-intended page. This is only meant for debugging purposes.
Supported HTML versions
We’ve expanded the set of supported HTML versions as well. Blaze now supports:
- HTML 5
- HTML 4 Strict
- HTML 4 Transitional
- HTML 4 Frameset
Additionally, I’ve been working on a tool
blaze-from-html (which needs to be separately installed using
cabal install blaze-from-html) to convert HTML to blaze code.
[jasper@alice ~]$ curl -S http://haskell.org/ | blaze-from-html -e | head docTypeHtml ! xmlns "http://www.w3.org/1999/xhtml" ! lang "en" $ do H.head $ do H.title "Haskell - HaskellWiki" meta ! name "KEYWORDS" ! content "Haskell" meta ! http_equiv "Content-type" ! content "text/html; charset=utf-8" meta ! name "robots" ! content "index,follow" link ! rel "shortcut icon" ! href "/favicon.ico" link ! rel "copyright" ! href "/haskellwiki/HaskellWiki:Copyrights" ...
-e flags ignores some errors, basically because the haskell homepage is XHTML, and
blaze-from-html wants to read HTML.
As you can see, the produced code is prettified and indented. If you use the
-s (standalone) flag, you will also get all the necessary imports and definitions, so you can directly compile the produced file.
Another big change is that we’ve changed the type for templates. From now on, all your templates will be of the type
Html instead of
Html (). We felt this choice is more sensible – we’re very sorry if this temporarily breaks your application.