| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Data.SortingNetwork.TH
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.