In favour of


Generic generation of HXT XmlPickler instances using Regular.

LTS Haskell 2.22:0.2
Stackage Nightly 2015-05-19:0.2
Latest on Hackage:0.2
BSD3 licensed by Silk
Maintained by

Module documentation for 0.2

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)


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

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


0.1.2 -> 0.2
- Upgrade to hxt 9.2/9.3.
- Allow missing data for Maybe fields in records.
- Add instances for Text in addition to String.
- More lenient Bool parsing.
- Better error reporting in Bool parsing.
- Strip leading and trailing underscores from element names.
- Only lowercase first character of element names.
- Add pickler for Either.
- Fixed recursive schema generation.
- Move from typLAB to Silk.
Depends on:
comments powered byDisqus