我怀疑这是一个noobie问题......
所以我有一个列表myList
,我想使用cassava库写入csv文件:
import qualified Data.ByteString.Lazy as BL
import qualified Data.Vector as V
import Data.Csv
main = BL.writeFile "myFileLocation" (encode $ V.fromList myList)
据我所知,编码类型ToRecord a => Vector a -> ByteString
但我收到以下错误:
Couldn't match expected type `[a0]'
with actual type `V.Vector (a,b,c,d)'
In the return type of a call of `V.fromList'
In the second argument of `($)', namely `V.fromList myList'
In the second argument of `BL.writeFile', namely
`(encode $ V.fromList myList)'
我很困惑!