autoproc-0.2.1: EDSL for Procmail scripts

Safe HaskellSafe
LanguageHaskell98

Autoproc.Classifier

Synopsis

Documentation

data Mailbox Source #

Constructors

Mailbox String 

data CExp Source #

Constructors

CExp [Flag] Cond Act 

Instances

data Flag Source #

Instances

Eq Flag Source # 

Methods

(==) :: Flag -> Flag -> Bool #

(/=) :: Flag -> Flag -> Bool #

Show Flag Source # 

Methods

showsPrec :: Int -> Flag -> ShowS #

show :: Flag -> String #

showList :: [Flag] -> ShowS #

data Act Source #

Instances

Show Act Source # 

Methods

showsPrec :: Int -> Act -> ShowS #

show :: Act -> String #

showList :: [Act] -> ShowS #

when :: Cond -> Act -> Writer [CExp] () Source #

also :: Act -> Act -> Act Source #

data Match a Source #

Constructors

Match a 

Instances

Monad Match Source # 

Methods

(>>=) :: Match a -> (a -> Match b) -> Match b #

(>>) :: Match a -> Match b -> Match b #

return :: a -> Match a #

fail :: String -> Match a #

Functor Match Source # 

Methods

fmap :: (a -> b) -> Match a -> Match b #

(<$) :: a -> Match b -> Match a #

Applicative Match Source # 

Methods

pure :: a -> Match a #

(<*>) :: Match (a -> b) -> Match a -> Match b #

(*>) :: Match a -> Match b -> Match b #

(<*) :: Match a -> Match b -> Match a #

sortBy :: (a -> Cond) -> a -> Mailbox -> Writer [CExp] () Source #

simpleSortByFrom :: String -> Writer [CExp] () Source #

If the email address (the String argument) contains "foo", then place the email into a folder by the name "foo". Actually, the name of the mailbox is created by appending boxPrefix which is defined in the Configuration module.

type Class = (String, [Cond]) Source #

subjectToMbox :: String -> String -> Writer [CExp] () Source #

If the subject line contains a certain string, send it to a certain mailbox.

addressToMbox :: String -> String -> Writer [CExp] () Source #

As with subjectToMbox, except by email address.

toAddressToMbox :: String -> String -> Writer [CExp] () Source #

addressToMbox is fine, but may not work well for mailing lists.

stuffToMbox :: Cond -> (a1 -> a) -> (a -> Cond -> Cond) -> String -> [a1] -> Writer [CExp] () Source #

stuffToMbox is a very general filtering statement, which is intended for specialization by other functions.

The idea is to take a logical operator and fold it over a list of strings. If the result is True, then the email gets dropped into a specified mailbox. So if you wanted to insist that only an email which has strings x, y, and z in the subject-line could appear in the xyz mailbox, you'd use .&&. as the logical operator, "xyz" as the mbox argument, [x, y, z] as the list, and a seed value of True. You also need the subject operator, which will map over the list and turn it into properly typed stuff.

subjectsToMbox :: [String] -> String -> Writer [CExp] () Source #

If all the strings appear in the subject line, deposit the email in the specified mailbox

anySubjectsToMbox :: [String] -> String -> Writer [CExp] () Source #

If any of the strings appear in the subject line, send it to the mbox This is currently a bit of a null-op, and I'm not sure it works.