On Wed, Sep 10, 2008 at 05:20:54PM -0400, David F. Place wrote: > Hi, All. > > I needed to make a batch of edits to some input files after a big change > in my program. Normally, one would choose some scripting language, but > I can't bear to program in them. The nasty thing about using Haskell > is that giving regexes as string constants sometime requires two levels > of quoting. For instance. (mkRegex "\\\\\\\\") matches \\.
I've been tempted to write a preprocessor that would accept Python-like strings, such as r'foo' (raw, with no backslash interpolation). And while we're at it, transform things like "Hi there, ${name}!" into "Hi there, " ++ name ++ "!" A dumb preprocessor should not be all that hard to write, I should think. Oh, also the """here docs""" would also be lovely. > To get around that, I put the regexes in the head of a literate program > and let the program gobble itself up. Works great! I think I'll always > turn to Haskell for my scripting needs now. Whoa, that is sneaky and clever. But it will fail the minute you try to run this on a compiled program, because then getProgName will give you the binary executable. -- John _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe