# Pastebin M1i564sm {-# LANGUAGE ApplicativeDo, NamedFieldPuns, RecordWildCards #-} data Thing = Thing { foo :: String , bar :: Int } -- | Placeholder data Parser a deriving (Functor) instance Applicative Parser where pure = undefined (<*>) = undefined -- Note: We don't need a monad instance because of {-# LANGAUGE ApplicativeDo #-} -- But it works fine with one too parseFoo :: Parser String parseFoo = undefined parseBar :: Parser Int parseBar = undefined -- With @-XNamedFieldPuns@: parseThing :: Parser Thing parseThing = do foo <- parseFoo bar <- parseBar pure Thing{foo, bar} -- With @-XRecordWildCards@: parseThing' :: Parser Thing parseThing' = do foo <- parseFoo bar <- parseBar pure Thing{..}