Skip to content

Commit

Permalink
Haddock documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
finnsson committed Oct 23, 2010
1 parent 144cd1b commit f84c9f3
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 1 deletion.
44 changes: 44 additions & 0 deletions src/Text/XML/QQ.hs
@@ -1,5 +1,48 @@
{-# OPTIONS_GHC -fglasgow-exts -XTemplateHaskell -XQuasiQuotes -XUndecidableInstances #-} {-# 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 module Text.XML.QQ (xmlQQ) where


-- import Text.XML.Light -- import Text.XML.Light
Expand All @@ -14,6 +57,7 @@ import Data.Maybe
import Text.ParserCombinators.Parsec import Text.ParserCombinators.Parsec
import Text.ParserCombinators.Parsec.Error import Text.ParserCombinators.Parsec.Error



xmlQQ :: QuasiQuoter xmlQQ :: QuasiQuoter
xmlQQ = QuasiQuoter xmlExp xmlPat xmlQQ = QuasiQuoter xmlExp xmlPat


Expand Down
9 changes: 8 additions & 1 deletion text-xml-qq.cabal
Expand Up @@ -13,7 +13,14 @@ Version: 0.1
Synopsis: Quasiquoter for xml. XML DSL in Haskell. Synopsis: Quasiquoter for xml. XML DSL in Haskell.


-- A longer description of the package. -- 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. -- URL for the project homepage or repository.
Homepage: http://www.github.com/finnsson/text-xml-qq Homepage: http://www.github.com/finnsson/text-xml-qq
Expand Down

0 comments on commit f84c9f3

Please sign in to comment.