úÎFa?ó@A library for reading and writing Haskell data from/to XML files(C) Robert Reitmeier, 2014GPL-3?concat ["public","< a t >","thinking","-","machines",".","net"] experimentaln/aNone 01234JKM The class ` declares that there is a pickler for the instance type wrapped by the generic representation's K1§ constructor. There are instances for data types that we do want to encode in more precise way, not following the generic pattern. For example, we want to encode unit () as a distinct tag <UNIT/>‰, not as text content generated with show/read. We give a default signature and definition which we can use conveniently by just stating instance ToFromXML Word32 for numeric types, for example.«Special chars are represented in XML by Haskell's escape sequences. A char is not embraced by single quotes in the tag content (as it would be using the default instance).QSince unfortunately CDATA sections are not supported with the Node types used in Text.XML.Expat.PickleÓ we are relying on, a String has to be represented in XML as a tag's text content, using the common Haskell escape sequences. For better readability and prevention of very long lines in the XML file, after each '\r', '\n' and '\t'  the same character is inserted unescaped after the character's escape sequence. The unescaped character is removed again when parsing the String. For example,  "abcndef"$ will be written in the XML file as  "abc\nndef", with the LF escaped (i.e. "\n") and followed by a real LF ('\n'Õ). Injecting line breaks and tabs makes long text much more readable und editable by humans (which is one of the original purposes of XML). The real LF will be filtered out again while parsing the XML file String.An instance of  provides a pickler for type a.iWe do not want our XML to be cluttered with nested tuples, so we flatten these in the XML representation.jGiven the current index in the flattened tuple, pickleProdN returns the incremented index and the pickler. GFor the picklers, are using nodes with both tag and text being Strings. KA helper function injecting an attribute with a given/fixed value in a tag. 4Pickles a string to/from text content with escaping ‘Pickle a tuple's i'th component. The component tag names are distinct, otherwise hexpat-pickle confuses this with a list and gives a parse error.,Converts generic Haskell data to a (strict)  ByteStringS containing the XML representation. In most cases, the data type would probably be  deriving   using the  DeriveGeneric language pragma./Construct generic Haskell data from a (strict)  ByteString> containing the XML representation. fromXMLEither will return  in case of a ,  otherwise.%Convenience function wrapping around /, throwing an error in case of a parsing error.uAction writing an XML representation of generic Haskell data to a file. The underlying writeFile operation is strict.bAction reading generic Haskell data from an XML file. The underlying readFile operation is strict.No tag created for M1 S s, this is handled in .No tag created for M1 S NoSelector, this is handled in .¾The CONSTRUCTOR tag contains a name attribute with the constructor's name. Strictly speaking it is unnecessary to encode the name as well, but improves readability and might add to safety...We won't construct a tag for M1 DU, since it is unnecessary and cluttering the XML. Although, it might add to safety...±For constructor arguments, one can also leave out the selector attribute (like Haskell syntax allows leaving out record syntax). This makes it easier to manually write data XML.€Pickling a product is done by first pickling the first component, and then pickling the second component with the current index i1 returned by the first  pickleProdN i. The current index i2 after pickleProdN i1 is returned.<    !"#$%&'()*+,-./0123456789:;<=>?F @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}9    !"#$%&'()*+,-./0123456789:;<=>?~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`aLbMcNdOePfgRhijklmnopqrrstuvwxyz{|}~tofromxml-0.1.0.2Text.XML.ToFromXML ToFromXML xMLPicklertoXML fromXMLEitherfromXMLwriteToXMLFilereadFromXMLFile PickleProdN pickleProdNPicklerxpElemWithAttrpickleContentString xpComponentbase GHC.GenericsGeneric Data.EitherLeft hexpat-0.20.7Text.XML.Expat.Internal.IO XMLParseErrorRight$fGToFromXMLM1$fGToFromXMLM10$fGToFromXMLM11$fGToFromXMLM12$fPickleProdNM1$fPickleProdN:*: GToFromXML gXMLPickler argTagNamesskipPickleString $fToFromXMLa$fToFromXMLArray$fToFromXMLSet$fToFromXMLEither$fToFromXMLMaybe$fToFromXML(,,,,,)$fToFromXML(,,,,)$fToFromXML(,,,)$fToFromXML(,,)$fToFromXML(,)$fToFromXMLIntMap$fToFromXMLMap $fToFromXML[]$fToFromXMLChar$fToFromXMLBool$fToFromXMLComplex$fToFromXMLRatio$fToFromXMLDouble$fToFromXMLFloat$fToFromXMLWord64$fToFromXMLWord32$fToFromXMLWord16$fToFromXMLWord8$fToFromXMLWord$fToFromXMLInteger$fToFromXMLInt64$fToFromXMLInt32$fToFromXMLInt16$fToFromXMLInt8$fToFromXMLInt$fToFromXML[]0 $fToFromXML()$fGToFromXMLK1$fGToFromXMLU1$fGToFromXML:+:$fGToFromXML:*:$fPickleProdNM10Generic1Datatype ConstructorSelectorV1U1Par1Rec1K1M1:+::*::.:RPDCSRec0Par0D1C1S1 NoSelectorRepRep1precunPar1unRec1unK1unM1L1R1unComp1Comp1 isNewtype moduleName datatypeNameselName conIsRecord conFixityconNameNoArityArityPrefixInfixFixityLeftAssociativeRightAssociativeNotAssociative Associativitytofromto1from1