Jeremy Shaw wrote: >> What is the status of the MIME Strike Force? > > Currently it is on hold while I work on some other higher priority > projects. But, I do hope to get back to it soon. (Or, perhaps someone > else will have time to work on it).
OK. Good to hear it is still alive, if slumbering. I know nothing about MIME, so I will make some comments ;-). > One way to express a filter that modifies an existing message is the > following: > >> exampleHeaders = >> ( (setHeader (Subject "whee")) . >> (setHeader (Subject "bork")). >> (addHeader (Keywords ["baz", "bar", "bam"])) . >> (addHeader (Keywords ["zip", "zap", "zop"])) >> ) > > where setHeader ensures that a header only appears once, and addHeader > appends the header, leaving existing instances alone. The type system > ensures that you can never call addHeader on (Subject > "whee"). Unfortunately, that code seems a bit verbose. If you want to signify that some headers are added and others replaced - which seems a good idea - then it's not so bad, is it? Perhaps replacing 'setHeader' by 'set', and removing some parentheses, it's pretty minimal: modifyHeaders = set (Subject "whee") . add (Keywords ["quux","blub"]) Anyway, I wouldn't bother too much about the exact syntax, at this stage. > A whole other area I have not dealt with yet is data-mining and > filters that depend on the values of existing fields. For example: > > 1. find all the headers that contain the string XXX > 2. find all the Keywords fields and merge them into a single Keywords > field Right. Another one: 3. Examine the contents of a certain header, and use the result to modify other headers. (Think of a spam filter, for instance.) I'm not sure what types of transformation we need to support. (I personally only need 'pure' parsing and composing, not this 'on-the-fly' transforming, but it is clearly necessary for some applications.) There are many similar problems. Suppose you need to change a CSS file, by changing RGB colours to corresponding HSL colours, but only within certain media sections and selectors. Furthermore, layout/whitespace/comments must be preserved as much as possible. As with modifying an e-mail on-the-fly, this cannot be done by first parsing the whole thing, then applying the transformation as a pure function, then unparsing. I have a vague idea on a way to deal with this, using some kind of stateful stream processor. I'll try to code it up some time; maybe it could be useful for MIME handling as well. Greetings, Arie _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe