ANNOUNCE: string-conversions-0.1

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

ANNOUNCE: string-conversions-0.1

Soenke Hahn
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



_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: ANNOUNCE: string-conversions-0.1

Joachim Breitner-2
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
  [hidden email]  |  [hidden email]  |  GPG: 0x4743206C
  xmpp: [hidden email] | http://www.joachim-breitner.de/


_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: ANNOUNCE: string-conversions-0.1

Michael Snoyman
On Fri, Mar 9, 2012 at 1:40 PM, Joachim Breitner
<[hidden email]> 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
>  [hidden email]  |  [hidden email]  |  GPG: 0x4743206C
>  xmpp: [hidden email] | http://www.joachim-breitner.de/
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> [hidden email]
> 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
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: ANNOUNCE: string-conversions-0.1

Joachim Breitner-2
Hi,

Am Freitag, den 09.03.2012, 13:44 +0200 schrieb Michael Snoyman:

> On Fri, Mar 9, 2012 at 1:40 PM, Joachim Breitner
> <[hidden email]> 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: [hidden email]
  Homepage: http://www.joachim-breitner.de
  Jabber-ID: [hidden email]

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: ANNOUNCE: string-conversions-0.1

Joachim Breitner-2
In reply to this post by Michael Snoyman
Hi,

Am Freitag, den 09.03.2012, 13:44 +0200 schrieb Michael Snoyman:

> On Fri, Mar 9, 2012 at 1:40 PM, Joachim Breitner
> <[hidden email]> 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: [hidden email]
  Homepage: http://www.joachim-breitner.de
  Jabber-ID: [hidden email]

--
Joachim "nomeata" Breitner
  [hidden email]  |  [hidden email]  |  GPG: 0x4743206C
  xmpp: [hidden email] | http://www.joachim-breitner.de/


_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: ANNOUNCE: string-conversions-0.1

Soenke Hahn
In reply to this post by Joachim Breitner-2
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
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: ANNOUNCE: string-conversions-0.1

Soenke Hahn
In reply to this post by Michael Snoyman
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
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: ANNOUNCE: string-conversions-0.1

Michael Snoyman
On Fri, Mar 9, 2012 at 4:36 PM, Sönke Hahn <[hidden email]> 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
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: ANNOUNCE: string-conversions-0.2

Soenke Hahn
In reply to this post by Soenke Hahn
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



_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe