Deprecated

In favour of

regular-xmlpickler

Generic generation of HXT XmlPickler instances using Regular.

http://github.com/silkapp/regular-xmlpickler

LTS Haskell 2.22:0.2
Stackage Nightly 2015-05-19:0.2
Latest on Hackage:0.2

See all snapshots regular-xmlpickler appears in

BSD-3-Clause licensed by Silk
Maintained by [email protected]
This version can be pinned in stack with:regular-xmlpickler-0.2@sha256:96e6bb416f0550d814450e27db266930447f504d3949b92c75e963c55f0c8bbc,1038

Module documentation for 0.2

Depends on 4 packages(full list with versions):
Used by 1 package in nightly-2014-12-14(full list with versions):

This package allows you to automatically derive hxt picklers (conversions to and from xml) using the regular generics package.

A simple example:

{-# LANGUAGE TemplateHaskell
           , EmptyDataDecls
           , TypeFamilies
           #-}

import Generics.Regular (deriveAll, PF)
import Text.XML.HXT.Arrow.Pickle (XmlPickler (..))
import Generics.Regular.XmlPickler (gxpickle)

data User = User
  { name  :: String
  , admin :: Bool
  }

-- Derive Regular instance.
deriveAll ''User "PFUser"
type instance PF User = PFUser

-- Define generic pickler instance.
instance XmlPickler User where
  xpickle = gxpickle

Now you can use the functionality from Text.XML.HXT.Arrow.Pickle. For example:

> showPickled [] (User "Simon" True)

"<user><name>Simon</name><admin>true</admin></user>"

> unpickleDoc xpickle $ head $ xread "<user><name>Simon</name><admin>true</admin></user>" :: Maybe User

Just (User {name = "Simon", admin = True})