ANNOUNCE: string-conversions-0.1

Hi all! string-conversions is a very simple package to facilitate dealing with different string types. It provides a simple type class that allows you to convert between values of different string types. It also provides type synonyms for these string types. Supported types are: - String - Strict ByteString - Lazy ByteString - Strict Text - Lazy Text http://hackage.haskell.org/package/string-conversions Any comments welcome. Cheers, Sönke

Hi Sönke, Am Freitag, den 09.03.2012, 11:17 +0100 schrieb Sönke Hahn:
Any comments welcome.
you could elaborate the documenatation “Assumes UTF-8” – I guess this only applies to the two ByteString variants, as String and Text _should_ contain unicode codepoints and no encoding. Not that someone tries to use a String where each Char corresponds to a byte in a UTF-8 encoded string and thinks he can convert it correctly. I was about to suggest to merge this into the convertible package (to fight package proliferation), but found that it seems it is already there: http://hackage.haskell.org/packages/archive/convertible-text/0.4.0.2/doc/htm... Greetings, Joachim -- Joachim "nomeata" Breitner mail@joachim-breitner.de | nomeata@debian.org | GPG: 0x4743206C xmpp: nomeata@joachim-breitner.de | http://www.joachim-breitner.de/

On Fri, Mar 9, 2012 at 1:40 PM, Joachim Breitner
Hi Sönke,
Am Freitag, den 09.03.2012, 11:17 +0100 schrieb Sönke Hahn:
Any comments welcome.
you could elaborate the documenatation “Assumes UTF-8” – I guess this only applies to the two ByteString variants, as String and Text _should_ contain unicode codepoints and no encoding. Not that someone tries to use a String where each Char corresponds to a byte in a UTF-8 encoded string and thinks he can convert it correctly.
I was about to suggest to merge this into the convertible package (to fight package proliferation), but found that it seems it is already there: http://hackage.haskell.org/packages/archive/convertible-text/0.4.0.2/doc/htm...
Greetings, Joachim
-- Joachim "nomeata" Breitner mail@joachim-breitner.de | nomeata@debian.org | GPG: 0x4743206C xmpp: nomeata@joachim-breitner.de | http://www.joachim-breitner.de/
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
I'm the author of convertible-text, and I consider it deprecated (it's marked as such in the synopsis). As far as string-conversions, I'm a little concerned that it's using decodeUtf8, which can throw exceptions from pure code for invalid UTF8 sequences. I would prefer decodeUtf8With lenientDecode. Actually, my *real* preference would be that a lenient decode was the default so that we aren't exposing a partial function as the default way to decode bytes. Michael

Hi, Am Freitag, den 09.03.2012, 13:44 +0200 schrieb Michael Snoyman:
On Fri, Mar 9, 2012 at 1:40 PM, Joachim Breitner
wrote: I was about to suggest to merge this into the convertible package (to fight package proliferation), but found that it seems it is already there: http://hackage.haskell.org/packages/archive/convertible-text/0.4.0.2/doc/htm...
I'm the author of convertible-text, and I consider it deprecated (it's marked as such in the synopsis).
sorry, I got confused. In convertible itself, there is -- Joachim Breitner e-Mail: mail@joachim-breitner.de Homepage: http://www.joachim-breitner.de Jabber-ID: nomeata@joachim-breitner.de

Hi, Am Freitag, den 09.03.2012, 13:44 +0200 schrieb Michael Snoyman:
On Fri, Mar 9, 2012 at 1:40 PM, Joachim Breitner
wrote: I was about to suggest to merge this into the convertible package (to fight package proliferation), but found that it seems it is already there: http://hackage.haskell.org/packages/archive/convertible-text/0.4.0.2/doc/htm...
I'm the author of convertible-text, and I consider it deprecated (it's marked as such in the synopsis).
sorry, I got confused by the two packages. In convertible itself, there is http://hackage.haskell.org/packages/archive/convertible/1.0.11.1/doc/html/sr... which only converts between String and the two Text types, but not between ByteString because the encoding is not know there. And sorry for the partial mail. Greetings, Joachim -- Joachim Breitner e-Mail: mail@joachim-breitner.de Homepage: http://www.joachim-breitner.de Jabber-ID: nomeata@joachim-breitner.de -- Joachim "nomeata" Breitner mail@joachim-breitner.de | nomeata@debian.org | GPG: 0x4743206C xmpp: nomeata@joachim-breitner.de | http://www.joachim-breitner.de/

Michael Snoyman wrote:
I'm the author of convertible-text, and I consider it deprecated (it's marked as such in the synopsis).
As far as string-conversions, I'm a little concerned that it's using decodeUtf8, which can throw exceptions from pure code for invalid UTF8 sequences. I would prefer decodeUtf8With lenientDecode.
I wasn't aware of 'decodeUtf8With lenientDecode'. I changed it in the repo.
Actually, my *real* preference would be that a lenient decode was the default so that we aren't exposing a partial function as the default way to decode bytes.
Are you talking about the default in decodeUtf8? (If yes, I tend to agree.) Sönke

On Fri, Mar 9, 2012 at 4:36 PM, Sönke Hahn
Michael Snoyman wrote:
I'm the author of convertible-text, and I consider it deprecated (it's marked as such in the synopsis).
As far as string-conversions, I'm a little concerned that it's using decodeUtf8, which can throw exceptions from pure code for invalid UTF8 sequences. I would prefer decodeUtf8With lenientDecode.
I wasn't aware of 'decodeUtf8With lenientDecode'. I changed it in the repo.
Actually, my *real* preference would be that a lenient decode was the default so that we aren't exposing a partial function as the default way to decode bytes.
Are you talking about the default in decodeUtf8? (If yes, I tend to agree.)
Yes, that's what I meant. Michael

Hi Joachim! Joachim Breitner wrote:
you could elaborate the documenatation “Assumes UTF-8” – I guess this only applies to the two ByteString variants, as String and Text _should_ contain unicode codepoints and no encoding. Not that someone tries to use a String where each Char corresponds to a byte in a UTF-8 encoded string and thinks he can convert it correctly.
Good point. I added a longer comment (in the repo).
I was about to suggest to merge this into the convertible package (to fight package proliferation), but found that it seems it is already there: http://hackage.haskell.org/packages/archive/convertible- text/0.4.0.2/doc/html/src/Data-Convertible-Instances-Text.html
I am aware of the Convertible class (and I really like it, btw.). But I wanted to allow for explicit string conversion. Data.Convertible.convert includes conversions with information loss (e.g. Float -> Int), while Data.String.Conversions.convertString (converts only strings and) preserves information in all cases. Cheers, Sönke

I've uploaded a new version to hackage incorporating suggestions from Joachim Breitner, Michael Snoyman and (offlist) Matthias Fischmann. The package now supplies (<>), a generic function for string concatenation. (Under ghc >= 7.4 this is a re-export from Data.Monoid to avoid name clashes.) Sönke Sönke Hahn wrote:
Hi all!
string-conversions is a very simple package to facilitate dealing with different string types. It provides a simple type class that allows you to convert between values of different string types. It also provides type synonyms for these string types.
Supported types are:
- String - Strict ByteString - Lazy ByteString - Strict Text - Lazy Text
http://hackage.haskell.org/package/string-conversions
Any comments welcome.
Cheers, Sönke
participants (3)
-
Joachim Breitner
-
Michael Snoyman
-
Sönke Hahn