Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
osa1 opened this issue Apr 25, 2017 · 1 comment
Open

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

osa1 opened this issue Apr 25, 2017 · 1 comment
Labels

Comments

@osa1
Copy link

osa1 commented Apr 25, 2017

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.

@hvr hvr added the question label Jun 15, 2017
@ivan-m
Copy link
Contributor

ivan-m commented Jun 20, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants