我正在尝试读取一些示例成功的 CSV 文件。这是我所拥有的
*Main System.IO> let result=parseCSV contents
*Main System.IO> result
Right [["Name","Value","Amount"],["Rob","1","10"],["Bob","1.42","15.3"],["Tom","452.2","23.1"]]
但是如果我尝试从这个数组中读取值,我会得到一个错误
*Main System.IO> head result
<interactive>:21:6:
Couldn't match expected type `[a0]'
with actual type `Either ParseError [[String]]'
In the first argument of `head', namely `result'
In the expression: head result
In an equation for `it': it = head result
那么我怎样才能摆脱权利并实际使用列表呢?
*Main System.IO> :t result
result :: Either ParseError [[String]]