follow-0.1.0.0: Haskell library to follow content published on any subject.

Safe HaskellNone
LanguageHaskell2010

Follow.Middlewares.Sort

Description

This middleware allows to sort the directory entries according to a comparison function. The comparison function has a type Entry -> Entry -> Ordering.

Some pre-built comparison function builders are also exported. Example:

import Follow
import Follow.Middlewares.Sort

-- Suppose we have a Directory d

apply (byGetter eTitle) d
Synopsis

Documentation

apply :: ComparisonFunction -> Middleware Source #

Middleware to sort a directory according to a given comparison function.

byGetter :: Ord a => EntryGetter a -> ComparisonFunction Source #

Creates a comparison function that sorts by the values returned by a getter

type ComparisonFunction = Entry -> Entry -> Ordering Source #

Function to compare entries.