Re: [Haskell-cafe] ANNOUNCE: string-conversions-0.1

2012-03-09 Thread 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/html/src/Data-Convertible-Instances-Text.html

Greetings,
Joachim

-- 
Joachim nomeata Breitner
  m...@joachim-breitner.de  |  nome...@debian.org  |  GPG: 0x4743206C
  xmpp: nome...@joachim-breitner.de | http://www.joachim-breitner.de/



signature.asc
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: string-conversions-0.1

2012-03-09 Thread Michael Snoyman
On Fri, Mar 9, 2012 at 1:40 PM, Joachim Breitner
m...@joachim-breitner.de wrote:
 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/html/src/Data-Convertible-Instances-Text.html

 Greetings,
 Joachim

 --
 Joachim nomeata Breitner
  m...@joachim-breitner.de  |  nome...@debian.org  |  GPG: 0x4743206C
  xmpp: nome...@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

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: string-conversions-0.1

2012-03-09 Thread Joachim Breitner
Hi,

Am Freitag, den 09.03.2012, 13:44 +0200 schrieb Michael Snoyman:
 On Fri, Mar 9, 2012 at 1:40 PM, Joachim Breitner
 m...@joachim-breitner.de 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/html/src/Data-Convertible-Instances-Text.html


 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: m...@joachim-breitner.de
  Homepage: http://www.joachim-breitner.de
  Jabber-ID: nome...@joachim-breitner.de


signature.asc
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: string-conversions-0.1

2012-03-09 Thread Joachim Breitner
Hi,

Am Freitag, den 09.03.2012, 13:44 +0200 schrieb Michael Snoyman:
 On Fri, Mar 9, 2012 at 1:40 PM, Joachim Breitner
 m...@joachim-breitner.de 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/html/src/Data-Convertible-Instances-Text.html


 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/src/Data-Convertible-Instances-Text.html
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: m...@joachim-breitner.de
  Homepage: http://www.joachim-breitner.de
  Jabber-ID: nome...@joachim-breitner.de

-- 
Joachim nomeata Breitner
  m...@joachim-breitner.de  |  nome...@debian.org  |  GPG: 0x4743206C
  xmpp: nome...@joachim-breitner.de | http://www.joachim-breitner.de/



signature.asc
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: string-conversions-0.1

2012-03-09 Thread Sönke Hahn
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



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: string-conversions-0.1

2012-03-09 Thread 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.)

Sönke



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: string-conversions-0.1

2012-03-09 Thread Michael Snoyman
On Fri, Mar 9, 2012 at 4:36 PM, Sönke Hahn sh...@cs.tu-berlin.de wrote:
 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

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe