hexpat-pickle-generic 0.1.2 → 0.1.3
raw patch · 2 files changed
+15/−13 lines, 2 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Text.XML.Expat.Pickle.Generic: Options :: (String -> String) -> (String -> String) -> Options
- Text.XML.Expat.Pickle.Generic: constructorTagModifier :: Options -> String -> String
- Text.XML.Expat.Pickle.Generic: data Options
- Text.XML.Expat.Pickle.Generic: defaultOptions :: Options
- Text.XML.Expat.Pickle.Generic: fieldLabelModifier :: Options -> String -> String
+ Text.XML.Expat.Pickle.Generic: XMLOptions :: (String -> String) -> (String -> String) -> XMLOptions
+ Text.XML.Expat.Pickle.Generic: data XMLOptions
+ Text.XML.Expat.Pickle.Generic: defaultXMLOptions :: Options
+ Text.XML.Expat.Pickle.Generic: xmlCtorModifier :: XMLOptions -> String -> String
+ Text.XML.Expat.Pickle.Generic: xmlFieldModifier :: XMLOptions -> String -> String
- Text.XML.Expat.Pickle.Generic: class IsXML a where xmlPickler = genericXMLPickler defaultOptions
+ Text.XML.Expat.Pickle.Generic: class IsXML a where xmlPickler = genericXMLPickler defaultXMLOptions
Files
hexpat-pickle-generic.cabal view
@@ -1,5 +1,5 @@ name: hexpat-pickle-generic-version: 0.1.2+version: 0.1.3 synopsis: Picklers for de/serialising Generic data types to and from XML license: BSD3 license-file: LICENSE
src/Text/XML/Expat/Pickle/Generic.hs view
@@ -22,18 +22,18 @@ module Text.XML.Expat.Pickle.Generic ( -- * Class- IsXML (..)+ IsXML (..) -- * Functions , encodeXML , decodeXML -- * Re-exported Data Types- , PU (..)+ , PU (..) -- * Options- , Options (..)- , defaultOptions+ , XMLOptions (..)+ , defaultXMLOptions -- * Generics , genericXMLPickler@@ -69,7 +69,7 @@ default xmlPickler :: (Generic a, GIsXML [UNode ByteString] (Rep a)) => PU [UNode ByteString] a- xmlPickler = genericXMLPickler defaultOptions+ xmlPickler = genericXMLPickler defaultXMLOptions -- -- Functions@@ -85,16 +85,18 @@ -- Defining Picklers -- -data Options = Options- { constructorTagModifier :: String -> String+data XMLOptions = XMLOptions+ { xmlCtorModifier :: String -> String -- ^ Function applied to constructor tags.- , fieldLabelModifier :: String -> String+ , xmlFieldModifier :: String -> String -- ^ Function applied to record field labels. } -defaultOptions :: Options-defaultOptions = Options id (dropWhile isLower)+type Options = XMLOptions +defaultXMLOptions :: Options+defaultXMLOptions = XMLOptions id (dropWhile isLower)+ -- -- Generics --@@ -125,13 +127,13 @@ instance (Constructor c, GIsXML [UNode ByteString] f) => GIsXML [UNode ByteString] (M1 C c f) where gXMLPickler opts f = xpElemNodes- (gxFromString . constructorTagModifier opts $ conName (undefined :: M1 C c f r))+ (gxFromString . xmlCtorModifier opts $ conName (undefined :: M1 C c f r)) ((M1, unM1) `xpWrap` gXMLPickler opts f) instance (Selector s, GIsXML [UNode ByteString] f) => GIsXML [UNode ByteString] (M1 S s f) where gXMLPickler opts f = xpElemNodes- (gxFromString . fieldLabelModifier opts $ selName (undefined :: M1 S s f r))+ (gxFromString . xmlFieldModifier opts $ selName (undefined :: M1 S s f r)) ((M1, unM1) `xpWrap` gXMLPickler opts f) --