xpOption,
xpPair,
xpText,
- xpTriple,
xpWrap )
-- Local imports.
import TSN.Database ( insert_or_select )
import TSN.DbImport ( DbImport(..), ImportResult(..), run_dbmigrate )
import TSN.Picklers ( xp_time_stamp )
-import TSN.Location ( Location(..) )
+import TSN.Location ( Location(..), pickle_location )
import TSN.XmlImport ( XmlImport(..) )
import Xml (
FromXml(..),
to_tuple m = (db_msg_id m, db_event_id m)
--- | Convert a 'Location' to/from XML.
---
-pickle_location :: PU Location
-pickle_location =
- xpElem "location" $
- xpWrap (from_tuple, to_tuple) $
- xpTriple (xpOption (xpElem "city" xpText))
- (xpOption (xpElem "state" xpText))
- (xpElem "country" xpText)
- where
- from_tuple =
- uncurryN Location
- to_tuple l = (city l, state l, country l)
-
-- | Convert a 'Message' to/from XML.
--