I have this:
import Database.HDBC.Sqlite3
import Database.HDBC
For converting fetched rows from a database I use this:
convertFromSql :: [SqlValue] -> [String]
convertFromSql [name, address, number, postal, city, country] =
[cName, cAddress, cNumber, cPostal, cCity, cCountry] where
cName = (fromSql name)
cAddress = (fromSql address) :: String
cNumber = (fromSql number) :: String
cPostal = (fromSql postal) :: String
cCity = (fromSql city) :: String
cCountry = (fromSql country) :: String
All works, but can I for example map
the fromSql
over the list of entries fetched from sql
? And maybe a longshot: zip
the mapped list with a list of types, so that code like above is more terse?