Dutch hug

381 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
381
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Dutch hug

  1. 1. BlazeHtml Design of a blazingly fast html combinator library
  2. 2. Hello! My name is jasper Studying BSc CS @ UGent I like to make things @jaspervdj jaspervdj.be
  3. 3. Introduction A web app usually has 3 important layers: ­ web application server ­ data storage layer ­ html generation layer
  4. 4. Trees in Haskell > data Tree > = Node Tree Tree > | Empty
  5. 5. Html is a tree This makes writing an Html generation library trivial in Haskell.
  6. 6. Le't write a library! > type Attribute = > (String, String) > type Tag = String
  7. 7. Le't write a library! > data Html > = Node Tag [Attribute] > Html > | Leaf Tag [Attribute] > | Concat [Html] > | Text String > deriving (Show)
  8. 8. Hackage quick look ­ html ­ xhtml ­ xhtml­combinators ­ moe ­ xhtml1
  9. 9. s/String/Data.Text/g ­ A first good step
  10. 10. s/String/Data.Text/g ­ A first good step text1 `append` text2
  11. 11. s/String/Data.Text/g ­ A first good step text1 `append` text2 BAD BAD BAD
  12. 12. No inspiration? Just shamelessly steal ideas from other Haskell projects.
  13. 13. Builder Monoid
  14. 14. 3­layer approach
  15. 15. Builder Fork fromText :: Text -> Builder fromEscapedText :: Text -> Builder fromShow :: Show a => a -> Builder fromRawAscii7Char :: Char -> Builder
  16. 16. Builder Fork Additional function: > fromUnsafeWrite > :: Int > -> (Ptr Word8 > -> IO ()) > -> Builder
  17. 17. Benchmarks
  18. 18. Benchmarks
  19. 19. Benchmarks
  20. 20. Benchmarks
  21. 21. The future Lots still to do until we have a stable, fast, awesome version. For the curious: github.com/jaspervdj/BlazeHtml
  22. 22. Questions?

×