Proposal: Add these two handy functions to Data.List

Duncan Coutts duncan.coutts at googlemail.com
Tue Jul 6 15:54:03 EDT 2010


On Fri, 2010-07-02 at 14:53 -0700, Bryan O'Sullivan wrote:
> On Fri, Jul 2, 2010 at 1:59 AM, Conor McBride
> <conor at strictlypositive.org> wrote:
>         The question for library designers is at what level to engage
>         with
>         this structure. In doing so, we should of course take care to
>         protect Joe Programmer from the Screaming Heebie-Jeebies. I am
>         not
>         qualified to judge how best this is to be done, but I thought
>         I
>         might at least offer some of the raw data for that
>         calculation.
> 
> I like Cale's proposal, and in fact it reminds me of something Duncan
> nudged me on a few months ago:
>
> http://www.serpentine.com/blog/2010/07/02/whats-in-a-find-function/ 


Yes, we discussed revising find yet again on the #ghc channel a month or
so ago. Despite having pushed you towards the one with type Text -> Text
-> (Text, [(Text, Text)]), I realised I still was not happy with it
either.

The one we discussed more recently is similar to what you are proposing
now. I think the difference was that in what I suggested, the middle
component of the tuple went to the end of the text, i.e. it was a prefix
of the last component.

I think the rationale for that was that you already know what you
searched for and we can save time and space by providing the full tail
rather than making new texts by recomposing the search term with the
trailing string.

Duncan



More information about the Libraries mailing list