Haskell Platform Proposal: add the 'text' library

Bryan O'Sullivan bos at serpentine.com
Thu Sep 9 14:36:30 EDT 2010

On Wed, Sep 8, 2010 at 5:21 PM, wren ng thornton <wren at community.haskell.org
> wrote:

>> Text: break :: Text ->  Text ->  (Text, Text)
>>       breakBy :: (Char ->  Bool) ->  Text ->  (Text, Text)
> One consistency problem I see with this is that the ByteString versions
> permit breaking on a disjunctive pattern (e.g., \c -> c=='a' || c=='q')
> whereas the Text version would require multiple passes to perform these
> queries, since it takes a Text instead of a (Text->Bool).

See breakBy in the email you quoted.

> Other than that, I do agree with the philosophy of the "deliberate and
> sensible" differences. Though, given the philosophy that these aren't
> Char-wise operations, why does Text.breakBy accept a (Char->Bool)? Is this
> just an optimization for common cases like breaking on Unicode-defined
> whitespace codepoints?

I kept breakBy in there because it is actually useful. I changed its name
because it's by far less common than "I want to break on a string".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/libraries/attachments/20100909/c28ea96e/attachment.html

More information about the Libraries mailing list