hexpat-pickle-generic 0.1.0 → 0.1.1
raw patch · 2 files changed
+15/−17 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: data Options
- Text.XML.Expat.Pickle.Generic: decode :: IsXML a => ByteString -> Maybe a
- Text.XML.Expat.Pickle.Generic: decodeEither :: IsXML a => ByteString -> Either String a
- Text.XML.Expat.Pickle.Generic: defaultOptions :: Options
- Text.XML.Expat.Pickle.Generic: encode :: IsXML a => a -> ByteString
+ Text.XML.Expat.Pickle.Generic: GenericXMLOptions :: (String -> String) -> (String -> String) -> GenericXMLOptions
+ Text.XML.Expat.Pickle.Generic: data GenericXMLOptions
+ Text.XML.Expat.Pickle.Generic: decodeXML :: IsXML a => ByteString -> Either String a
+ Text.XML.Expat.Pickle.Generic: defaultXMLOptions :: Options
+ Text.XML.Expat.Pickle.Generic: encodeXML :: IsXML a => a -> ByteString
- Text.XML.Expat.Pickle.Generic: class IsXML a where xmlPickler = genericXMLPickler defaultOptions
+ Text.XML.Expat.Pickle.Generic: class IsXML a where xmlPickler = genericXMLPickler defaultXMLOptions
- Text.XML.Expat.Pickle.Generic: constructorTagModifier :: Options -> String -> String
+ Text.XML.Expat.Pickle.Generic: constructorTagModifier :: GenericXMLOptions -> String -> String
- Text.XML.Expat.Pickle.Generic: fieldLabelModifier :: Options -> String -> String
+ Text.XML.Expat.Pickle.Generic: fieldLabelModifier :: GenericXMLOptions -> String -> String
Files
hexpat-pickle-generic.cabal view
@@ -1,5 +1,5 @@ name: hexpat-pickle-generic-version: 0.1.0+version: 0.1.1 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
@@ -25,16 +25,15 @@ IsXML (..) -- * Functions- , encode- , decode- , decodeEither+ , encodeXML+ , decodeXML -- * Re-exported Data Types , PU (..) -- * Options- , Options (..)- , defaultOptions+ , GenericXMLOptions (..)+ , defaultXMLOptions -- * Generics , genericXMLPickler@@ -70,34 +69,33 @@ default xmlPickler :: (Generic a, GIsXML [UNode ByteString] (Rep a)) => PU [UNode ByteString] a- xmlPickler = genericXMLPickler defaultOptions+ xmlPickler = genericXMLPickler defaultXMLOptions -- -- Functions -- -encode :: IsXML a => a -> ByteString-encode = pickleXML' (xpRoot xmlPickler)--decode :: IsXML a => ByteString -> Maybe a-decode = either (const Nothing) Just . decodeEither+encodeXML :: IsXML a => a -> ByteString+encodeXML = pickleXML' (xpRoot xmlPickler) -decodeEither :: IsXML a => ByteString -> Either String a-decodeEither = unpickleXML' defaultParseOptions (xpRoot xmlPickler)+decodeXML :: IsXML a => ByteString -> Either String a+decodeXML = unpickleXML' defaultParseOptions (xpRoot xmlPickler) -- -- Defining Picklers -- -data Options = Options+data GenericXMLOptions = GenericXMLOptions { constructorTagModifier :: String -> String -- ^ Function applied to constructor tags. , fieldLabelModifier :: String -> String -- ^ Function applied to record field labels. } -defaultOptions :: Options-defaultOptions = Options id (dropWhile isLower)+type Options = GenericXMLOptions++defaultXMLOptions :: Options+defaultXMLOptions = GenericXMLOptions id (dropWhile isLower) -- -- Generics