Open jwaldmann opened 8 years ago
current situation is:
data
Translation is ad-hoc - that is, not uniform (generic) over the data type declarations. (For reference, here is a generic transformation: http://repetae.net/repos/DrIFT/src/Rules/Xml.hs)
So my current code is a mess of
So, we have a problem similar to mapping data declaration <-> existing data base schema. In persistent , you can specify details of the mapping via annotations to the model. This needs template haskell, see https://github.com/yesodweb/persistent/blob/master/persistent-template/Database/Persist/TH.hs
persistent
Plan (long-term)
C1 { a1 = foo }
data T = C1 { a1 :: A1, .. } | ..
<T><C1><a1> ...</a1>..</C1></T>
current situation is:
data
declarationsTranslation is ad-hoc - that is, not uniform (generic) over the data type declarations. (For reference, here is a generic transformation: http://repetae.net/repos/DrIFT/src/Rules/Xml.hs)
So my current code is a mess of
So, we have a problem similar to mapping data declaration <-> existing data base schema. In
persistent
, you can specify details of the mapping via annotations to the model. This needs template haskell, see https://github.com/yesodweb/persistent/blob/master/persistent-template/Database/Persist/TH.hsPlan (long-term)
C1 { a1 = foo }
of typedata T = C1 { a1 :: A1, .. } | ..
to<T><C1><a1> ...</a1>..</C1></T>
, so that is has all information