[Haskell-cafe] regular-xmlpickler

Adam Bergmark adam at bergmark.nl
Sat Jul 12 01:14:17 UTC 2014


Hi Grant,

This is an edge case since you have a field name with the same name as a
constructor. regular-xmlpickler doesn't try to treat this case differently,
I'm not sure if there is a good way to generically fix this in the way you
want.

That said, you can always write your own picklers using plain hxt to
flatten the structure, and note that you can mix custom instances with
regular-xmlpickler generated ones.

Also see the hxt-pickle-utils[1] package for a few helper functions

[1] http://hackage.haskell.org/package/hxt-pickle-utils

Cheers,
Adam



On Sat, Jul 12, 2014 at 12:47 AM, gbwey9 <gbwey9 at gmail.com> wrote:

> Hi,
>
> I am using a very cool package called regular-xmlpickler.
> Does anyone know of a way to skip one level of nesting for nested complex
> fields? So I would like to elide that outer/inner Header.
>
> Here is the full code: http://lpaste.net/107362
>
> data User = User
>   { name  :: String
>   , admin :: Bool
>   , dt :: UTCTime
>   , header :: Header
>   }
>
> data Header = Header
>   { header1 :: String
>   , header2 :: String
>   }
>
> so instead of generating <header> twice
>
> <header>
>    <header>
>       <header1>abb</header1>
>       <header2>abb</header2>
>    </header>
> </header>
>
> I would like to have it generate this.
>
>    <header>
>       <header1>abb</header1>
>       <header2>abb</header2>
>    </header>
>
>
> Thanks,
> Grant
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140712/669d7747/attachment.html>


More information about the Haskell-Cafe mailing list