yesod-dsl-0.1: codegen/json-wrapper.cg
instance ToJSON Day where
toJSON = toJSON . show
instance FromJSON Day where
parseJSON x = do
s <- parseJSON x
case reads s of
(d, _):_ -> return d
[] -> mzero
instance ToJSON TimeOfDay where
toJSON = toJSON . show
instance FromJSON TimeOfDay where
parseJSON x = do
s <- parseJSON x
case reads s of
(d, _):_ -> return d
[] -> mzero