
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 \\. 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. I put the file in the Haskell Pastebin, if you would like to see it. http://hpaste.org/10249 Cheers, David

Hi guys,
Any ideas how to integrate Haskell into other software as scripting engine?
Similarly to Python in Blender or GIMP or to JavaScript in the products from
Adobe. Which possibilities we have?
Cheers,
Alex.
On Wed, Sep 10, 2008 at 10:20 PM, David F. Place
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 \\.
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.
I put the file in the Haskell Pastebin, if you would like to see it.
Cheers, David
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

2008/9/10 Olex P
Hi guys,
Any ideas how to integrate Haskell into other software as scripting engine? Similarly to Python in Blender or GIMP or to JavaScript in the products from Adobe. Which possibilities we have?
This is also very interesting to me. At my day job we use embedded python and COM access as the extension languages to a very large application we produce. I would love to augment with the embedded python with an option for haskell "scripts". I doubt I'd get the go head with such a change, but it's fun to dream about and propose regardless. Jason

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

On Wed, 2008-09-10 at 16:57 -0500, John Goerzen wrote:
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.
Sooooo, I won't do that. In addition to getProgName getting the binary, the compiler would have thrown away the comments. The point is that this is a convenient way to write simple scripts.

2008/9/10 David F. Place
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 \\.
Since some times in the HEAD and in the future 6.10 release, you can use quasiquoting to get nice regex syntax as in Perl or Ruby. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/regexqq (quasiquoting basically allows you to embed a DSL with significantly different syntax in your Haskell and still get typechecking and other advantages at compile-time (though I imagine the errors won't be very nice). -- Jedaï
participants (5)
-
Chaddaï Fouché
-
David F. Place
-
Jason Dagit
-
John Goerzen
-
Olex P