Following the advice from the comments in the StackOverflow, I am making use of uncurry4 function like below to map to a record:
uncurry4 func (a, b, c, d) = func a b c d
getEmailConfig :: PGConnection -> IO [EmailConfig]
getEmailConfig conn = do
result <- pgQuery conn selectEmailQ
pure $ map (uncurry4 EmailConfig) result
So, I wonder if this is a correct/idiomatic way of doing the mapping of result to a Haskell record? Or, is there some other better way of achieving this? I looked at the Database.PostgreSQL.Typed.Relation module but I don't think it is meant for this purpose.
Haskell newbie trying to understand how I can get this to work. I have a record defined like this:
When I execute the SQL query like following, I wish to map it to a record.
Following the advice from the comments in the StackOverflow, I am making use of
uncurry4
function like below to map to a record:So, I wonder if this is a correct/idiomatic way of doing the mapping of result to a Haskell record? Or, is there some other better way of achieving this? I looked at the Database.PostgreSQL.Typed.Relation module but I don't think it is meant for this purpose.