[Haskell-cafe] needsaname :: ([a] -> Maybe (b, [a])) -> (b ->
[a]) -> [a] -> [a]
jules at jellybean.co.uk
Fri Jul 6 17:09:38 EDT 2007
Bulat Ziganshin wrote:
> Hello Jules,
> Friday, July 6, 2007, 10:00:12 PM, you wrote:
>> to think of many more uses of this function. I actually wrote it to do
>> HTML fix-up, working with the TagSoup library. A few quick definitions
>> and it becomes easy to express things like 'remove all FONT, BR and U
>> tags; replace all instances of B with SPAN CLASS="important"...'; the
>> task of repairing broken HTML and replacing simplistic markup with
>> semantic markup. It's very powerful to have the separation between
>> selection and transformation; it's quite easy to build up powerful
>> libraries of selectors and use them with simple transformers.
> hm. are you know about existence of haskell regexp libs? :)
Indeed. And regexps can be used to built plenty of interesting selectors.
However, some selectors like 'balanced tags' or 'tag with class A and
class B in any order' are hard or impossible to write with regexps.
More information about the Haskell-Cafe