我有这个:
import Database.HDBC.Sqlite3
import Database.HDBC
为了转换从数据库中获取的行,我使用这个:
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
所有作品,但我可以例如map
从fromSql
获取的条目列表中sql
吗?也许是一个远景:zip
带有类型列表的映射列表,所以上面的代码更简洁?