Summary and call for discussion on text proposal

Roman Leshchinskiy rl at cse.unsw.EDU.AU
Sun Nov 7 18:09:37 EST 2010


On 07/11/2010, at 14:36, Duncan Coutts wrote:

> There is essentially just one point of contention, over about 10 out
> of the 80+ functions in the Data.Text module. The issue is about which
> functions should get the nice names and about consistency between
> modules.

The issue is whether we expect packages in the platform to follow established conventions. This is a rather fundamental design question and it would be nice if it could be resolved one way or another. The text package has merely highlighted the problem; I'm sure it will come up with other libraries as well. Accepting text as is does resolve this question by default which perhaps explains why some insist on discussing it. The text package is not really the issue - the fundamental design question is. Dismissing it as a naming issue isn't really helpful. It's really something that should have been decided independently of any particular package.

To show what I mean by established conventions, here is the result of a quick search on hackage for occurences of break with similar semantics to text.

Packages where the first argument is a predicate (in the order that Hayoo shows them):

haskell98/base
bytestring
containers (as breakl and breakr in Data.Sequence)
vector
utf8-string
enumerator
Stream
utility-ht
stream-fusion
storablevector
ListLike
iteratee
heap
compact-string/compact-string-fix
heaps
container-classes

Packages where the first argument is something else:

text

I apologise in advance if I missed any.

> Option 3
> --------
> 
> breakStr :: Text           -> Text -> (Text, Text)
> breakChr :: (Char -> Bool) -> Text -> (Text, Text)

There are several *By functions in text. Are you proposing to rename them all to *Chr? 

Disclaimer: This post does not express any preference one way or another on the author's part, in the hope of avoiding any bikeshedding, lynching or slinging arrows.

Roman




More information about the Libraries mailing list