Anyone suggest .csv file parser?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Anyone suggest .csv file parser?

Jeon-Young Kang
Hi all.

I am working on import *.csv file into haskell.

As you guys recommended, I built code for comparison human's age as follows.

data Person = Person {name:: String, age:: Int } deriving(Show)
data Relations = Friend | Older | Younger

class Comparison a where
    compare:: a -> a -> Relations

instance Comparison Person where
    compare (Person a b) (Person a b)
         | b1 == b2 = Friend
         | b1 > b2 = Older
         | b1 < b2 = Younger


Also, I have .csv file as follows.

name age
tom 19
jane 21

By using above code, I would like to apply the above code for .csv file.

What is the best for this purpose?

Sincerely,
JY

_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Anyone suggest .csv file parser?

Francesco Ariis
On Sat, Nov 28, 2015 at 09:42:58PM -0500, Jeon-Young Kang wrote:
> Hi all.
>
> I am working on import *.csv file into haskell.
>
> [..]
>
> What is the best for this purpose?

I use http://hackage.haskell.org/package/csv and never had troubles
with it. `parseCSV` returns a list of lists ([[String]]) which is
easy enough to manipulate for whatever you need.

_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Anyone suggest .csv file parser?

Ryan Trinkle-3
I'd recommend taking a look at cassava.

On Sat, Nov 28, 2015 at 9:54 PM, Francesco Ariis <[hidden email]> wrote:
On Sat, Nov 28, 2015 at 09:42:58PM -0500, Jeon-Young Kang wrote:
> Hi all.
>
> I am working on import *.csv file into haskell.
>
> [..]
>
> What is the best for this purpose?

I use http://hackage.haskell.org/package/csv and never had troubles
with it. `parseCSV` returns a list of lists ([[String]]) which is
easy enough to manipulate for whatever you need.

_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Anyone suggest .csv file parser?

Jeon-Young Kang
Thanks for your recommendation.
Now, I am looking through cassava. I just got to know how to import *.csv file to haskell.
Then, if I need calculate something (summary, dividing, and so on), can you give me an example source code?

Sincerely,



On Sun, Nov 29, 2015 at 4:07 AM, Ryan Trinkle <[hidden email]> wrote:
I'd recommend taking a look at cassava.

On Sat, Nov 28, 2015 at 9:54 PM, Francesco Ariis <[hidden email]> wrote:
On Sat, Nov 28, 2015 at 09:42:58PM -0500, Jeon-Young Kang wrote:
> Hi all.
>
> I am working on import *.csv file into haskell.
>
> [..]
>
> What is the best for this purpose?

I use http://hackage.haskell.org/package/csv and never had troubles
with it. `parseCSV` returns a list of lists ([[String]]) which is
easy enough to manipulate for whatever you need.

_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners




--
Department of Geography
State University of New York at Buffalo

 
Jeon-Young Kang

_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners