[database-devel] ByteString and Text - any conventions?
jjhellst at gmail.com
Sun Aug 12 20:18:14 CEST 2012
While working on https://github.com/nurpax/sqlite-simple there have
been occasions when I've tried to decide whether to use ByteStrings or
I note that postgresql-simple and mysql-simple use ByteStrings
exclusively in the API.
Has a convention formed in the Haskell community on which strings
should be used in APIs that pass strings around?
In my case, blobs will anyway be passed around as ByteStrings. But
SQLite's C strings are UTF8 and some might prefer to Text over
ByteStrings. Or support both in the API?
This matters in the low-level bindings too, where result accessors
need to return either ByteStrings or Text objects for TEXT fields.
Currently direct-sqlite uses the String type but Irene is thinking of
changing the type to a more efficient representation
Sqlite-simple links against both bytestring and text already, so from
a purely package dependency point of view the choice doesn't really
matter. But sqlite-direct will need to choose one or the other for
its string type in the SQLText s constructor.
More information about the database-devel