Permalink
Browse files

Haddock documentation

  • Loading branch information...
1 parent 144cd1b commit f84c9f307414148d4e17d059a4c0624ef385ebd9 @finnsson committed Oct 23, 2010
Showing with 52 additions and 1 deletion.
  1. +44 −0 src/Text/XML/QQ.hs
  2. +8 −1 text-xml-qq.cabal
View
@@ -1,5 +1,48 @@
{-# OPTIONS_GHC -fglasgow-exts -XTemplateHaskell -XQuasiQuotes -XUndecidableInstances #-}
+
+-- | The XML quasiquoter.
+--
+-- Given the variables
+--
+-- > url = "google.se"
+-- > elem = "gmail"
+-- > attrNs = "something"
+-- > attrName = "Pelle"
+-- > attrValue = "Arne"
+-- > elemCont = CRef "testing"
+-- > cont1 = Elem $ element { elName = qname "hej" }
+-- > cont2 = CRef "other test"
+--
+-- the code
+--
+-- > [$xmlQQ|
+-- > <{url}:{elem} {attrNs}:{attrName}={attrValue} attr="cool">
+-- > <elem ns1:elem1="1" ns2:elem2="2"><<elemCont>></elem>
+-- > <elem />
+-- > <el />
+-- > <<cont1>>
+-- > <<cont2>>
+-- > </{url}:{elem}>
+-- > |]
+--
+-- will generate the data structure
+--
+-- > element {
+-- > elName = QName elem Nothing (Just url),
+-- > elAttribs = [Attr (QName attrName Nothing (Just attrNs)) attrValue,
+-- > Attr (qname "attr") "cool"],
+-- > elContent = [
+-- > (Elem $ element { elName = qname "elem",
+-- > elAttribs = [Attr (QName "elem1" Nothing (Just "ns1")) "1",
+-- > Attr (QName "elem2" Nothing (Just "ns2")) "2"],
+-- > elContent = [elemCont]
+-- > }),
+-- > (Elem $ element { elName = qname "elem" }),
+-- > (Elem $ element { elName = qname "el" }),
+-- > cont1,
+-- > cont2]
+-- > }
module Text.XML.QQ (xmlQQ) where
-- import Text.XML.Light
@@ -14,6 +57,7 @@ import Data.Maybe
import Text.ParserCombinators.Parsec
import Text.ParserCombinators.Parsec.Error
+
xmlQQ :: QuasiQuoter
xmlQQ = QuasiQuoter xmlExp xmlPat
View
@@ -13,7 +13,14 @@ Version: 0.1
Synopsis: Quasiquoter for xml. XML DSL in Haskell.
-- A longer description of the package.
--- Description:
+Description:
+ XML quasiquoter. Can convert XML code into Haskell data structures compile time.
+ .
+ At the moment only Text.XML.Light (xml-package) backend.
+ .
+ Supports namespaces, attributes, embedding Haskell variables etc.
+ .
+ See github for more information and examples of usage.
-- URL for the project homepage or repository.
Homepage: http://www.github.com/finnsson/text-xml-qq

0 comments on commit f84c9f3

Please sign in to comment.