This Haskell library implements RSV, a clever format designed as a simpler and more reliable replacement for CSV. You can read more about RSV here.
- Any value which implements
ToValuemay be written to RSV. - Any value which implements
FromValuemay be read from RSV. - Any type which implements
ToRowmay be written to an RSV row. - Any type which implements
FromRowmay be read from an RSV row. - Since
ByteStrings are not guaranteed to be UTF-8, they are assumed to be binary data and are encoded in Base-64. - The
Stringtype is also not guaranteed to be UTF-8, but since it's so commonly used, it will be written directly to RSV format and assumed to be UTF-8. Its implementation oftoValueusesencodeStringUnsafe. If you write aStringthat is not UTF-8, you will get an exception when reading it back out. For this reason I do not recommend the use of theStringtype with RSV, since it's unsafe. - It's strongly recommended to use the
Texttype to represent strings. - Common data types like
Int,Integer,Double,UUID, etc. can be encoded directly to RSV. - The
Booldata type is encoded by default as the stringstrueandfalse. When reading theBooltype, the (case-insensitive) stringstrue,t,yes,y,1,false,f,no,nand0will be recognized. If you want to use some other string values, you have two choices. You can create anewtypewrapper aroundBooland implementToValueandFromValuefor it. Or you can change theParserConfigand pass it toencodeWithandparseWith. See the unit tests. - See the unit tests for usage, especially of advanced techniques like writing your own record types as RSV rows.