Proposal: Export String from Data.String (and two related proposals)

Duncan Coutts duncan.coutts at googlemail.com
Wed Nov 17 15:46:06 EST 2010


On Wed, 2010-10-20 at 22:19 +0200, Bas van Dijk wrote:
> Hello,
> 
> I would like to make three proposals, in order of importance IMHO:
> 
> 1. Export String from Data.String. Most modules in base and on
> Hackage of the form: Data.<type> also export <type>. I think it's
> surprising and confusing that Data.String doesn't conform to this
> pattern.

Seems reasonable.

> 2. Unexport String from Data.Char. I feel less strongly about this
> one, but in general I think it is good that a symbol is exported from as
> few modules as possible.

Again, seems reasonable and you say not too many package break.

> 3. Export the String operations: lines, words, unlines and
> unwords from Data.String. I feel even less strongly about this one.
> However these are operations on Strings so it makes sense to export them
> from Data.String. As a counter argument you could say these operations
> either receive or produce a _list_ of Strings so they only belong in
> Data.List.

I agree. We did this for the ByteString modules, we have
Data.ByteString[.Lazy] and Data.ByteString[.Lazy].Char8. Only the latter
ones export the functions that depend on the ASCII encoding. These four
are the only functions in Data.List that specialise the [a] to [Char].

> If we accept 3 then in the spirit of  "export a symbol from as few modules
> as possible", you may expect a fourth proposal: Unexport the String
> operations: lines, words, unlines and unwords from Data.List.
> However I think this will break lots of programs. I have no problem also
> discussing this one though.

Yeah, I agree in principle, but probably best to leave that for later.

Duncan



More information about the Libraries mailing list