> readRow (ParserOptions Nothing "," NoQuoting) "bill,true,true,false" :: Rec (Either Text) ["Name" :-> Text, "Cat" :-> Bool, "Dog" :-> Bool, "Goldfish" :-> Bool]
{Right Name :-> "bill", Right Cat :-> True, Right Dog :-> True, Right Goldfish :-> False}
Requires OverloadedStrings, DataKinds, TypeOperators.
If you then want to extract data you can then do something like
> rget (Proxy :: Proxy ("Name" :-> Text)) row
Right Name :-> "bill"
I assume there is some easier API for this (looks like via template haskell?). Seems kind of sad if there's no convenient way to do things without using TH, but I don't see anything obvious.
--Will
I have a case where some of my data is stored in CSV matrix form like this example of a table telling whether person i has pet j
,cat,dog,goldfish
bill,true,true,false
sue,false,true,true
fred,false,false,true
I can't see any obvious way to read this sort of thing in with the Data.Frames package. Would love to be told differently.
Thanks! -Tyson
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-caf e
Only members subscribed via the mailman list are allowed to post.