EDSL for Procmail scripts

Latest on Hackage:0.2.1

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow to host generated Haddocks.

BSD3 licensed by Jason Dagit
Maintained by Jason Dagit
= Autoproc =

Autoproc is a utility/language for email filtering. Autoproc makes it
easy to define filtering rules. The rules define a Haskell program,
that when executed generates a valid Procmail recipes file. This file
can then be used with Procmail to sort and filter your email before
you see it.

You will need to have GHC or Hugs, Procmail and formail installed.

== Installation ==

To get a copy of Autoproc, use

darcs get

If you don't have darcs do not despair, currently Autoproc is about 5
files and can be easily downloaded by pointing your web browser at the
address just given.

You can also visit Hackage, where you should be able to find a tarball of autoproc (or eventually you could install Autoproc through cabal-install).

== Customizing Autoproc ==

Autoproc runs on the XMonad model. If you aren't familiar with XMonad, the idea is that the package is constructed such that it provides a library, and then it compiles a thin executable using that library.

This is fine if the baked in configuration exactly suits your needs, but how do you have a system-wide XMonad which you can configure in a full Haskell style without some sort of Emacs-style interpreter? Well, the thin executable is tasked with looking for a xmonad.hs in a fixed location; if it exists, it gets compiled and the *new* binary gets run. And your personal xmonad.hs can do anything it wants - as all of XMonad's functionality is exposed as a library your xmonad.hs can import and modify at will. So your xmonad.hs boils down to 'main = xmonad $ myCrazyFunkyArgs'.

In Autoproc's case, what you do is create ~/.autoproc/autoproc.hs, and then set things up. (If you don't, Autoproc will use its compiled in configuration, which is surely not what you want.)

While I was testing this Xmonad-style configuration, I created an autoproc.hs that looks like this:

> import Autoproc.Configuration (defaultVariables)
> import Autoproc.Run
> import Autoproc.Rules.Dagit

> main ∷ IO ()
> main = do print "foo bar"
> autoprocMain defaultVariables dagitRules

('defaultVariables' provides the key-values of environmental variables, and 'dagitRules' is all the Procmail filtering rules.)

Now, this is the same environmental variables and configuration rules used by default, but there's nothing stopping me from taking defaultVariables and replacing it with

> myVariables = [("SHELL", "/bin/zsh")]

And I can run arbitrary stuff before and after the rules and variables are compiled down to text - my output will start with "foo bar", as useless a customization as that is...

== Running Autoproc ==

To run the autoproc binary and save your rules to the file recipes use the
following command:

$ autoproc > recipes

If you are familiar with Procmail you may want to examine the file to
see that everything was generated correctly. Once you are confident
that you would like to use this file, you can simply move it to
$HOME/.procmailrc Depending on your system you may need to do
additional configuration to get Procmail itself running. Usually this
is done with a .forward file, or on some systems having a .procmailrc
is enough.

Depends on:
Used by 1 package:
comments powered byDisqus