Popularity
7.2
Declining
Activity
0.0
Stable
1
13
0

Monthly Downloads: 36
Programming language: Haskell
License: BSD 3-clause "New" or "Revised" License
Tags: Data     Generic     XML    

generic-xmlpickler alternatives and similar packages

Based on the "generic" category.
Alternatively, view generic-xmlpickler alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of generic-xmlpickler or a related project?

Add another 'generic' Package

README

regular-xmlpickler

Build Status

This package is deprecated in favor of generic-xmlpickler

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})