Haskell Platform Proposal: add the 'text' library
Bryan O'Sullivan
bos at serpentine.com
Sun Oct 10 00:13:01 EDT 2010
On Fri, Oct 8, 2010 at 8:00 AM, Ross Paterson <ross at soi.city.ac.uk> wrote:
>
> text base bytestring type in text (or equivalent if absent)
> ---------------------------------------------------------------------------
> break - breakSubstring Text -> Text -> (Text, Text)
> breakBy break break (Char -> Bool) -> Text -> (Text, Text)
> breakEnd - - Text -> Text -> (Text, Text)
> - - breakEnd (Char -> Bool) -> Text -> (Text, Text)
> count - - Text -> Text -> Int
> - - count Char -> Text -> Int
> find - - Text -> Text -> [(Text, Text)]
> findBy find find (Char -> Bool) -> Text -> Maybe Char
> partitionBy partition - (Char -> Bool) -> Text -> (Text, Text)
> replicate - - Int -> Text -> Text
> - replicate replicate Int -> Char -> Text
> spanBy span span (Char -> Bool) -> Text -> (Text, Text)
> split - - Text -> Text -> [Text]
> - - split Char -> Text -> [Text]
> splitBy - splitWith (Char -> Bool) -> Text -> [Text]
> unfoldrN - - Int -> (a -> Maybe (Char, a)) -> a ->
> Text
> - - unfoldrN Int -> (a -> Maybe (Char, a)) -> a ->
> (Text, Maybe a)
> zipWith zipWith - (Char -> Char -> Char) -> Text -> Text
> -> Text
> - zipWith zipWith (Char -> Char -> a) -> Text -> Text ->
> [a]
>
> * The -By suffix has been used for predicate versions in 5 cases here,
> but not for filter and findIndex.
>
In the case of filter, that's because a filter function that didn't accept a
predicate wouldn't be useful. I added findIndex for completeness back when
that was the tack I was taking, but it arguably shouldn't be present at all,
since it's subsumed by find.
* The find function has no connection with findBy. It ought to have a
> name that is the plural of the name of the break function.
Again, this is present for completeness, and makes little obvious sense to
retain.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/libraries/attachments/20101009/7c2d211b/attachment.html
More information about the Libraries
mailing list