
On Thu, Sep 09, 2010 at 11:36:30AM -0700, Bryan O'Sullivan wrote:
On Wed, Sep 8, 2010 at 5:21 PM, wren ng thornton
wrote:
Text: break :: Text -> Text -> (Text, Text) breakBy :: (Char -> Bool) -> Text -> (Text, Text)
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".
That makes sense if considering text in isolation, but as part of a system I would prefer consistent names between []/String, bytestring and text. (It shouldn't necessarily be text that changes, though). I also wonder if there should be a f :: (Text -> Bool) -> Text -> (Text, Text) where e.g. the current break is (\t -> f (t `isPrefixOf`)). Thanks Ian