Use xpPrim instead of the (removed) xpickle for Bools.
Replace xpPrim with xpInt where possible.
import Text.Printf ( printf )
import Text.Read ( readMaybe )
import Text.XML.HXT.Arrow.Pickle (
- XmlPickler(..),
xpText,
xpWrapMaybe )
import Text.XML.HXT.Arrow.Pickle.Xml ( PU )
-instance XmlPickler Bool where
- xpickle =
- (to_bool, from_bool) `xpWrapMaybe` xpText
- where
- to_bool :: String -> Maybe Bool
- to_bool = readMaybe
-
- from_bool :: Bool -> String
- from_bool = show
-
-- | (Un)pickle a UTCTime without the time portion.
--
xp4Tuple,
xp6Tuple,
xpElem,
+ xpInt,
xpList,
xpPrim,
xpText,
xpElem "listing" $
xpWrap (from_tuple, to_tuple) $
xp4Tuple (xpElem "team" xpText)
- (xpElem "teamno" xpPrim)
+ (xpElem "teamno" xpInt)
(xpElem "injuries" xpText)
(xpElem "updated" xpPrim)
where
pickle_message =
xpElem "message" $
xpWrap (from_tuple, to_tuple) $
- xp6Tuple (xpElem "XML_File_ID" xpPrim)
+ xp6Tuple (xpElem "XML_File_ID" xpInt)
(xpElem "heading" xpText)
(xpElem "category" xpText)
(xpElem "sport" xpText)
xp6Tuple,
xp10Tuple,
xpElem,
+ xpInt,
xpList,
xpPrim,
xpText,
xpElem "PlayerListing" $
xpWrap (from_tuple, to_tuple) $
xp10Tuple (xpElem "TeamID" xp_team_id)
- (xpElem "PlayerID" xpPrim)
+ (xpElem "PlayerID" xpInt)
(xpElem "Date" xp_date)
(xpElem "Pos" xpText)
(xpElem "Name" xpText)
(xpElem "Injury" xpText)
(xpElem "Status" xpText)
(xpElem "Fantasy" xpText0)
- (xpElem "Injured" xpickle)
+ (xpElem "Injured" xpPrim)
(xpElem "Type" xpText)
where
from_tuple = uncurryN PlayerListing
pickle_message =
xpElem "message" $
xpWrap (from_tuple, to_tuple) $
- xp6Tuple (xpElem "XML_File_ID" xpPrim)
+ xp6Tuple (xpElem "XML_File_ID" xpInt)
(xpElem "heading" xpText)
(xpElem "category" xpText)
(xpElem "sport" xpText)
xp12Tuple,
xpAttr,
xpElem,
+ xpInt,
xpList,
xpOption,
xpPair,
- xpPrim,
xpText,
xpTriple,
xpWrap )
import TSN.Codegen (
tsn_codegen_config,
- tsn_db_field_namer -- Used in a test.
- )
+ tsn_db_field_namer ) -- Used in a test
import TSN.DbImport ( DbImport(..), ImportResult(..) )
import Xml ( ToFromXml(..), pickle_unpickle )
pickle_msg_id =
xpElem "msg_id" $
xpWrap (from_tuple, to_tuple) $
- xpPair xpPrim (xpAttr "EventId" (xpOption xpPrim))
+ xpPair xpInt (xpAttr "EventId" (xpOption xpInt))
where
from_tuple = uncurryN MsgId
to_tuple m = (db_msg_id m, db_event_id m)
pickle_message =
xpElem "message" $
xpWrap (from_tuple, to_tuple) $
- xp12Tuple (xpElem "XML_File_ID" xpPrim)
+ xp12Tuple (xpElem "XML_File_ID" xpInt)
(xpElem "heading" xpText)
pickle_msg_id
(xpElem "category" xpText)