# Pastebin RNBBmdUn data Tea = Tea { id :: Int32, name :: Text } res :: Result (Int32, Text) res = undefined -- doesn't matter in the example, but you'd get it from elsewhere in your program resultToTea1 :: Result (Int32, Text) -> Result Tea resultToTea1 result = fmap toTea result where toTea (i, t) = Tea i t -- Same as above, but "eta-reduced" (we don't need to name the argument) resultToTea2 :: Result (Int32, Text) -> Result Tea resultToTea2 = fmap toTea where toTea (i, t) = Tea i t -- Same as above, but noticing that `uncurry Tea :: (Int32, Text) -> Tea` happens to be what we need resultToTea3 :: Result (Int32, Text) -> Result Tea resultToTea3 = fmap toTea where toTea res = uncurry Tea res -- Same as above, but eta-reducing toTea resultToTea4 :: Result (Int32, Text) -> Result Tea resultToTea4 = fmap toTea where toTea = uncurry Tea -- Same as above, but inlining toTea resultToTea5 :: Result (Int32, Text) -> Result Tea resultToTea5 = fmap (uncurry Tea)