[Haskell-cafe] ANN: New release of ZeroTH

Robin Green greenrd at greenrd.org
Tue Jun 23 18:00:33 EDT 2009


This announcement will only be of interest to Haskell programmers
using, or thinking of using, Template Haskell.

I am very pleased to announce a new release (2009.6.23.3) of ZeroTH
(also known as zeroth), a tool for preprocessing Haskell code to run
splices and remove Template Haskell dependencies:

 http://hackage.haskell.org/package/zeroth

For example, you could use it to reduce the size of your Haskell
program binaries, if you use Template Haskell. (zeroth now actually
uses itself on itself, for this very purpose, and you can use
the Distribution.ZeroTH module for that in your own cabal projects.)

It's still very much a hack - in that it would probably be more
efficient and clean to implement it as an option to GHC
- but hopefully now at least it's a slightly *better* hack.

Lemmih has kindly agreed to hand over the job of being maintainer
of ZeroTH to me. So please send any patches or complaints my way. The
new darcs repository for the project, which is a darcs 2 repository, is
at:

 http://patch-tag.com/publicrepos/zerothDarcs2

For this release, the "cabal" command-line tool is the only officially
supported means of installation. So you should do something like:

 cabal update
 cabal install zeroth

to install it. To get a summary of command-line options, type:

 zeroth --help

Major changes from previous releases:

* Much more Haskell code is now supported. This is partly because the
  code has been updated to work with the just-released
  haskell-src-exts 1.0.0; and partly because it supports a wider
  variety of Template Haskell code, including code which refers to
  definitions declared in the same source file.

* It is now compulsory to specify any Haskell language extensions you
  are using in the input file, with a LANGUAGE pragma. (For debugging
  purposes, zeroth prints to stderr the result of parsing the LANGUAGE
  pragma, if any. If haskell-src-exts doesn't understand the LANGUAGE
  pragma, this will be Nothing. But that shouldn't happen.)

* Template Haskell imports are now *automatically* stripped by default
  by zeroth, and so cpphs doesn't need to be run if you aren't otherwise
  using CPP.

* New command-line options have been added (see zeroth --help).

* Error messages are now more informative.

* Librification! Almost anything can benefit from being made into a
  library, and zeroth is no exception. Of course, the executable is
  still there.

* You can still use it on certain code which doesn't compile in GHC
  (yes, really, I've tested this!) but you now have to use the
  --only-splices option if you want to do this. Obviously, the splices
  themselves have to compile. --only-splices also makes zeroth faster.

It is very lightly tested, so it might not work for your code out of the
box. Please let me know if you have any problems with it, no matter how
small.

Happy hacking,
-- 
Robin


More information about the Haskell-Cafe mailing list