- from_tuple = uncurryN MostLapsLeading
- to_tuple m = (db_most_laps_leading_driver_id m,
- db_most_laps_leading_driver m,
- db_most_laps_leading_number_of_laps m)
+ from_tuple :: (Maybe Int, Maybe String, Maybe Int) -> Maybe MostLapsLeading
+ from_tuple (Just x, Just y, Just z) =
+ Just $ MostLapsLeading (Just x) (Just y) (Just z)
+ from_tuple _ = Nothing
+
+ -- Sure had to go out of my way to avoid the warnings about unused
+ -- db_most_laps_foo fields here.
+ to_tuple' :: Maybe MostLapsLeading -> (Maybe Int, Maybe String, Maybe Int)
+ to_tuple' Nothing = (Nothing, Nothing, Nothing)
+ to_tuple' (Just (MostLapsLeading Nothing _ _)) = (Nothing, Nothing, Nothing)
+ to_tuple' (Just (MostLapsLeading _ Nothing _)) = (Nothing, Nothing, Nothing)
+ to_tuple' (Just (MostLapsLeading _ _ Nothing)) = (Nothing, Nothing, Nothing)
+ to_tuple' (Just m) = (db_most_laps_leading_driver_id m,
+ db_most_laps_leading_driver m,
+ db_most_laps_leading_number_of_laps m)