2

我有这个:

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 

所有作品,但我可以例如mapfromSql获取的条目列表中sql吗?也许是一个远景:zip带有类型列表的映射列表,所以上面的代码更简洁?

4

0 回答 0