haskell-hvr/cassava

'decodeByName' require same number of rows?

tom-bop opened this issue · 0 comments

With too many columns, decodeByName silently throws away the extra columns:

>  decodeByName "a,b,c\n1,2,3,4" :: Either String (Header, V.Vector (HM.HashMap String String))
Right (["a","b","c"],[fromList [("a","1"),("b","2"),("c","3")]])

It also happily parses a row with too few:

>  decodeByName "a,b,c\n1,2" :: Either String (Header, V.Vector (HM.HashMap String String))
Right (["a","b","c"],[fromList [("a","1"),("b","2")]])

Is there (or should there be) a parsing mode which requires the same number of columns per row as there are header rows? There seems to be support from the spec:

Each line should contain the same number of fields throughout the file.

https://tools.ietf.org/html/rfc4180