autoproc: EDSL for Procmail scripts

[ bsd3, library, program, system ] [ Propose Tags ] [ Report a vulnerability ]

Autoproc is a utility which allows you to write an email filterer in an Haskell EDSL (embedded domain specific language); autoproc will then compile it down to a Procmail configuration file (.procmailrc). This file can then be used with Procmail to sort and filter your email before you see it.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1, 0.1.1, 0.1.2, 0.2.1
Dependencies base (>=4 && <5), directory, mtl, process, unix [details]
Tested with ghc ==7.10.3
License BSD-3-Clause
Author Jason Dagit
Maintainer Jason Dagit <dagitj@gmail.com>
Category System
Home page https://github.com/dagit/autoproc
Source repo head: git clone https://github.com/dagit/autoproc.git
Uploaded by JasonDagit at 2016-08-13T00:01:34Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Executables autoproc
Downloads 3425 total (11 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2016-10-27 [all 1 reports]

Readme for autoproc-0.2.1

[back to package description]
= 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 http://code.haskell.org/autoproc

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.