summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
2572fc6)
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 (
import Text.Printf ( printf )
import Text.Read ( readMaybe )
import Text.XML.HXT.Arrow.Pickle (
xpText,
xpWrapMaybe )
import Text.XML.HXT.Arrow.Pickle.Xml ( PU )
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.
--
-- | (Un)pickle a UTCTime without the time portion.
--
xp4Tuple,
xp6Tuple,
xpElem,
xp4Tuple,
xp6Tuple,
xpElem,
xpElem "listing" $
xpWrap (from_tuple, to_tuple) $
xp4Tuple (xpElem "team" 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
(xpElem "injuries" xpText)
(xpElem "updated" xpPrim)
where
pickle_message =
xpElem "message" $
xpWrap (from_tuple, to_tuple) $
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)
(xpElem "heading" xpText)
(xpElem "category" xpText)
(xpElem "sport" xpText)
xp6Tuple,
xp10Tuple,
xpElem,
xp6Tuple,
xp10Tuple,
xpElem,
xpElem "PlayerListing" $
xpWrap (from_tuple, to_tuple) $
xp10Tuple (xpElem "TeamID" xp_team_id)
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 "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
(xpElem "Type" xpText)
where
from_tuple = uncurryN PlayerListing
pickle_message =
xpElem "message" $
xpWrap (from_tuple, to_tuple) $
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)
(xpElem "heading" xpText)
(xpElem "category" xpText)
(xpElem "sport" xpText)
xp12Tuple,
xpAttr,
xpElem,
xp12Tuple,
xpAttr,
xpElem,
xpList,
xpOption,
xpPair,
xpList,
xpOption,
xpPair,
xpText,
xpTriple,
xpWrap )
import TSN.Codegen (
tsn_codegen_config,
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 )
import TSN.DbImport ( DbImport(..), ImportResult(..) )
import Xml ( ToFromXml(..), pickle_unpickle )
pickle_msg_id =
xpElem "msg_id" $
xpWrap (from_tuple, to_tuple) $
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)
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) $
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)
(xpElem "heading" xpText)
pickle_msg_id
(xpElem "category" xpText)