Follow.Middlewares.Filter

Description

This middleware allows to filter the directory entries according to a predicate. The predicate is a function Entry -> Bool.

Some pre-built predicate builders are also exported. Example:

import Follow
import Follow.Middlewares.Filter

-- Suppose we have a Directory d

apply (eTitle equalP "Some title") d

Synopsis

# Documentation

Middleware to filter a directory according to a given predicate.

type Predicate = Entry -> Bool Source #

Predicate that takes an Entry as argument.

equalP :: Eq a => EntryGetter a -> a -> Predicate Source #

Builds a predicate which takes the field returned by the getter and compares with given value for equality. It returns False when field is Nothing.

lessP :: Ord a => EntryGetter a -> a -> Predicate Source #

Builds a predicate which takes the field returned by the getter and compares whether it is less than given value. It returns False when field is Nothing.

greaterP :: Ord a => EntryGetter a -> a -> Predicate Source #

Builds a predicate which takes the field returned by the getter and compares whether it is greater than given value. It returns False when field is Nothing.

Builds a predicate which takes given value and checks whether it is an infix for the field returned by given getter. It returns False when field is Nothing.

Builds a predicate which takes given value and checks whether it is a prefix for the field returned by given getter. It returns False when field is Nothing.

Builds a predicate which takes given value and checks whether it is a suffix for the field returned by given getter. It returns False when field is Nothing.

Builds a predicate which combines with a logical and given predicates.

Builds a predicate which combines with a logical or given predicates.

Build a predicte which negates the result of given predicate.