yesod-dsl-0.1.1.22: 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
instance ToJSON Checkmark where
toJSON Active = A.String "Active"
toJSON Inactive = A.String "Inactive"
instance FromJSON Checkmark where
parseJSON (A.String "Active") = return Active
parseJSON (A.String "Inactive") = return Inactive
parseJSON _ = mzero