hxt pickling question

Hi, Trying to understand how to write a document using a pickler but I can't make sense of the types. From the example: runX ( xunpickleDocument xpSeason [ withValidate no , withTrace 1 , withRemoveWS yes , withPreserveComment no ] "simple2.xml" >>> processSeason >>> xpickleDocument xpSeason [ withIndent yes ] "new-simple2.xml" ) So all I want to do is pickle a value directly instead of reading the value from a document. I expected to do something like: runX (someHXTPicklingFunction myValue >>> xpickleDocument ...) but I can't seem to figure out what someHXTPicklingFunction should be, it's certainly nothing obvious like pickleDoc, because that generates the wrong value. Seems like I probably have a much more fundamental problem in that I really don't understand how the arrow part of this little example really works, but I was kind of hoping that doing something "simple" like this might shed some light on that. And then was immediately stuck in type hell. Thanks, Brian

There's showPickled [0] and unpickleDoc [1], maybe those help?
Erik
[0] http://hackage.haskell.org/packages/archive/hxt/latest/doc/html/Text-XML-HXT...
[1] http://hackage.haskell.org/packages/archive/hxt/latest/doc/html/Text-XML-HXT...
On Thu, Jan 24, 2013 at 4:40 PM,
Hi,
Trying to understand how to write a document using a pickler but I can't make sense of the types.
From the example:
runX ( xunpickleDocument xpSeason [ withValidate no , withTrace 1 , withRemoveWS yes , withPreserveComment no ] "simple2.xml" >>> processSeason >>> xpickleDocument xpSeason [ withIndent yes ] "new-simple2.xml" )
So all I want to do is pickle a value directly instead of reading the value from a document. I expected to do something like:
runX (someHXTPicklingFunction myValue >>> xpickleDocument ...)
but I can't seem to figure out what someHXTPicklingFunction should be, it's certainly nothing obvious like pickleDoc, because that generates the wrong value.
Seems like I probably have a much more fundamental problem in that I really don't understand how the arrow part of this little example really works, but I was kind of hoping that doing something "simple" like this might shed some light on that. And then was immediately stuck in type hell.
Thanks,
Brian
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On Thu, 24 Jan 2013 17:05:15 +0100
Erik Hesselink
There's showPickled [0] and unpickleDoc [1], maybe those help?
Thank you , they help a lot :-) I was stuck looking in Text.XML.HXT.Arrow.Pickle for the answer and got lost trying to decipher IOStateArrow s a XmlTree and runX. It's odd that there does not seem to be a way to use the example so that a tree can be written directly to a file. xpickleDocument :: PU a -> SysConfigList -> String -> IOStateArrow s a XmlTreeSource store an arbitray value in a persistent XML document Except there doesn't seem to be a way to pass that value into xpickleDocument without reading a document first using xunpickleDocument. Thanks again. Brian
Erik
[0] http://hackage.haskell.org/packages/archive/hxt/latest/doc/html/Text-XML-HXT... [1] http://hackage.haskell.org/packages/archive/hxt/latest/doc/html/Text-XML-HXT...
On Thu, Jan 24, 2013 at 4:40 PM,
wrote: Hi,
Trying to understand how to write a document using a pickler but I can't make sense of the types.
From the example:
runX ( xunpickleDocument xpSeason [ withValidate no , withTrace 1 , withRemoveWS yes , withPreserveComment no ] "simple2.xml" >>> processSeason >>> xpickleDocument xpSeason [ withIndent yes ] "new-simple2.xml" )
So all I want to do is pickle a value directly instead of reading the value from a document. I expected to do something like:
runX (someHXTPicklingFunction myValue >>> xpickleDocument ...)
but I can't seem to figure out what someHXTPicklingFunction should be, it's certainly nothing obvious like pickleDoc, because that generates the wrong value.
Seems like I probably have a much more fundamental problem in that I really don't understand how the arrow part of this little example really works, but I was kind of hoping that doing something "simple" like this might shed some light on that. And then was immediately stuck in type hell.
Thanks,
Brian
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (2)
-
briand@aracnet.com
-
Erik Hesselink