sorting-network-0.2.1.0: Sort small lists with sorting network.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.SortingNetwork.TH

Synopsis

Documentation

gMkSortBy :: MkPairs -> Int -> ([Pat] -> Pat) -> ([Exp] -> Exp) -> Q Exp Source #

gMkSortBy mkPairs n mkP mkE generates a function that sorts elements using sorting network.

mkP :: [Pat] -> Pat and mkE :: [Exp] -> Exp deals with unpacking input value and packing final results respectively. This generalization allows us to deal with lists, tuples, and unboxed-tuples all at once.

mkUnsafeSortListBy :: MkPairs -> Int -> ExpQ Source #

mkUnsafeSortListBy mkPairs n generates an expression of type (a -> a -> Ordering) -> [a] -> [a].

Note that resulting function is partial and requires input list to contain exactly n elements.

mkSortTupBy :: MkPairs -> Int -> ExpQ Source #

mkSortTupBy mkPairs n generates an expression of type (a -> a -> Ordering) -> (a, a, ...) -> (a, a, ...).

Where the input and output tuple (a, a, ...) contains n elements.