servant-util-0.2: Servant servers utilities.
Safe HaskellNone
LanguageHaskell2010

Servant.Util.Combinators.Sorting.Construction

Description

Manual construction of sorting spec.

Synopsis

Documentation

data SortingRequestItem (provided :: [TyNamedParam *]) Source #

Helper for defining custom SortingSpecs, contains SortingItem corresponding to one of parameter in provided list.

Instances

Instances details
Show (SortingRequestItem provided) Source # 
Instance details

Defined in Servant.Util.Combinators.Sorting.Construction

Methods

showsPrec :: Int -> SortingRequestItem provided -> ShowS #

show :: SortingRequestItem provided -> String #

showList :: [SortingRequestItem provided] -> ShowS #

asc :: forall name provided. (KnownSymbol name, KnownTypeName provided name provided) => NameLabel name -> SortingRequestItem provided Source #

Ascendant sorting on a field with given name.

desc :: forall name provided. (KnownSymbol name, KnownTypeName provided name provided) => NameLabel name -> SortingRequestItem provided Source #

Ascendant sorting on a field with given name.

mkSortingSpec :: ReifySortingItems base => [SortingRequestItem provided] -> SortingSpec provided base Source #

Make a sorting specification. Specified list should contain sorting on distinct fields; we do not enforce this at type-level for convenience.

Example:

-- 

sortingSpec :: SortingSpec ["id" ?: Int, "desc" ?: Text]
sortingSpec = mkSortingSpec [asc #id]

noSorting :: ReifySortingItems base => SortingSpec provided base Source #

Do not specify ordering.

Orphan instances

ReifySortingItems base => IsList (SortingSpec provided base) Source #

Instance for SortingSpec construction.

Instance details

Associated Types

type Item (SortingSpec provided base) #

Methods

fromList :: [Item (SortingSpec provided base)] -> SortingSpec provided base #

fromListN :: Int -> [Item (SortingSpec provided base)] -> SortingSpec provided base #

toList :: SortingSpec provided base -> [Item (SortingSpec provided base)] #

ReifySortingItems base => Default (SortingSpec provided base) Source #

By default noSorting is used.

Instance details

Methods

def :: SortingSpec provided base #