cassava icon indicating copy to clipboard operation
cassava copied to clipboard

No way to encode Csv type without going through Data.Vector.toList ?

Open osa1 opened this issue 8 years ago • 1 comments

It seems from the documentation that there's no way to directly encode the Csv type, and instead I have to generate a list first. This looks weird, because Csv type is defined in cassava as a representation of csv, but the library doesn't actually give a way to encode it.

osa1 avatar Apr 25 '17 08:04 osa1

If I understand what you're asking, then I don't think there's a problem:

λ> :i Data.Csv.Csv
type cassava-0.5.0.0:Data.Csv.Types.Csv =
  vector-0.12.0.1:Data.Vector.Vector
    cassava-0.5.0.0:Data.Csv.Types.Record
  	-- Defined in ‘cassava-0.5.0.0:Data.Csv.Types’
λ> :i Data.Csv.Record
type cassava-0.5.0.0:Data.Csv.Types.Record =
  vector-0.12.0.1:Data.Vector.Vector
    cassava-0.5.0.0:Data.Csv.Types.Field
  	-- Defined in ‘cassava-0.5.0.0:Data.Csv.Types’
λ> :i Data.Csv.Field
type cassava-0.5.0.0:Data.Csv.Types.Field = ByteString
  	-- Defined in ‘cassava-0.5.0.0:Data.Csv.Types’

(The 0.5.0.0 is because I ran this in a sandbox where I was testing out the current git version.)

So if you import and use Vector, then you have that type Csv = Vector (Vector (ByteString)), which if you really wanted to you could manipulate yourself.

ivan-m avatar Jun 20 '17 00:06 ivan-m