-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Use records for query parameters in servant APIs. -- -- Having positional parameters in servant can be error-prone, -- especially when there are a lot of them and they have similar types. -- This package solves that problem by letting one use records to specify -- query parameters in servant APIs. Use -- servant-queryparam-server for servers, -- servant-queryparam-client for clients, -- [servant-queryparam-openapi3](https:/hackage.haskell.orgpackageservant-queryparam-openapi3) -- for [openapi3](https:hackage.haskell.orgpackage/openapi3). -- See the README for more information. @package servant-queryparam-core @version 2.0.0 -- | This module provides functions to modify Symbols and type-level -- lists. -- -- The workflow to define a modification function can be as follows. -- --
    --
  1. Use ToList to convert a Symbol to a type-level list -- of Chars.
  2. --
  3. Use functions from here and from the package -- first-class-families for type-level lists -- (Fcf.Data.List).
  4. --
  5. Use FromList to convert a type-level list of Chars -- back to a Symbol.
  6. --
-- -- Example (see DropPrefix): -- --
--   >>> :kind! DropPrefix "_userParams_category"
--   DropPrefix "_userParams_category" :: Symbol
--   = "category"
--   
-- -- Modules that use the Eval type family (e.g., -- Servant.Record) must be imported together with modules that -- export instances of Eval (see the GHC documentation on -- Type families). module Servant.QueryParam.TypeLevel -- | Expression evaluator. type family Eval (e :: Exp a) :: a -- | Kind of type-level expressions indexed by their result type. type Exp a = a -> Type -- | Convert a list of Chars to a Symbol. -- --
--   >>> :kind! FromList ['a', '+', 'c']
--   FromList ['a', '+', 'c'] :: Symbol
--   = "a+c"
--   
type family FromList (cs :: [Char]) :: Symbol -- | Convert a list of Chars to a Symbol. -- -- In this list, Chars go in a reverse order. -- --
--   >>> :kind! FromList1 ['a', 'b', 'c'] ""
--   FromList1 ['a', 'b', 'c'] "" :: Symbol
--   = "cba"
--   
type family FromList1 (syms :: [Char]) (sym :: Symbol) :: Symbol -- | Convert a Symbol to a list of Chars. type family ToList (sym :: Symbol) :: [Char] -- | Convert a possibly unconsed Symbol to a list of Chars. type family ToList1 (sym :: Maybe (Char, Symbol)) :: [Char] -- | Type equality. -- --

Details

-- -- The base library also defines a similar (==); it -- differs from TyEq in the following ways: -- -- data TyEq (c :: a) (d :: b) (e :: Bool) -- | Type inequality data NotTyEq :: a -> b -> Exp Bool -- | Drop leading underscores. -- --
--   >>> :kind! Eval (DropUnderscores ['_', '_', 'a'])
--   Eval (DropUnderscores ['_', '_', 'a']) :: [Char]
--   = '['a']
--   
type DropUnderscores = DropWhile (TyEq '_') -- | Drop leading non-underscores. -- --
--   >>> :kind! Eval (DropNonUnderscores ['a', 'a', '_'])
--   Eval (DropNonUnderscores ['a', 'a', '_']) :: [Char]
--   = '['_']
--   
type DropNonUnderscores = DropWhile (NotTyEq '_') -- | Drop the prefix of a Symbol. -- --
--   >>> :kind! DropPrefix "_userParams_category"
--   DropPrefix "_userParams_category" :: Symbol
--   = "category"
--   
type family DropPrefix (sym :: Symbol) :: Symbol -- | This module provides functions and instances for working with query -- parameter records. module Servant.QueryParam.Record -- | RecordParam uses fields in a record to represent query -- parameters. -- -- For each record field: -- -- -- -- For example, this API: -- --
--   type API = "users" :> (QueryParam "category" Category :>
--                          QueryParam' '[Required, Strict] "sort_by" SortBy :>
--                          QueryFlag "with_schema" :>
--                          QueryParams "filters" Filter :>
--                          Get '[JSON] User)
--   
-- -- can be written using records: -- --
--   data DropPrefixExp :: sym -> Exp sym
--   
--   type instance Eval (DropPrefixExp sym) = DropPrefix sym
--   
--   data UserParams = UserParams
--     { _userParams_category :: Maybe Category
--     , _userParams_sort_by :: SortBy
--     , _userParams_with_schema :: Bool
--     , _userParams_filters :: [Filter]
--     }
--   
--   type API = "users" :> RecordParam DropPrefixExp UserParams :> Get '[JSON] User
--   
-- -- Here, DropPrefixExp wraps a sym into Exp. -- -- The instance of Eval for DropPrefixExp sym drops the -- prefix of that sym via DropPrefix. -- -- DropPrefix is applied to the fields of UserParams. -- -- The "_userParams_category" record field corresponds to the -- query parameter "category". data RecordParam (mod :: Symbol -> Exp Symbol) (a :: Type) -- | Type family for rewriting a RecordParam API to a regular -- servant API. This family is useful for defining instances of -- classes that extract information from the API type, such as classes -- from servant-swagger or servant-foreign. -- -- Typical use: -- --
--   instance SomeClass (UnRecordParam (RecordParam mod a :> api))) =>
--            SomeClass (RecordParam mod a :> api) where
--      someMethod _ = someMethod (Proxy :: Proxy (UnRecordParam (RecordParam mod a :> api))
--   
type family UnRecordParam (mod :: Symbol -> Exp Symbol) (x :: Type) :: Type instance (GHC.Generics.Generic a, Servant.QueryParam.Record.GHasLink mod (GHC.Generics.Rep a) sub) => Servant.Links.HasLink (Servant.QueryParam.Record.RecordParam mod a Servant.API.Sub.:> sub) instance Servant.QueryParam.Record.GHasLink mod a sub => Servant.Links.HasLink (Servant.QueryParam.Record.GParam mod (a ()) Servant.API.Sub.:> sub) instance forall k (mod :: GHC.Types.Symbol -> Fcf.Core.Exp GHC.Types.Symbol) (c :: * -> *) (sub :: k) (m :: GHC.Generics.Meta). Servant.QueryParam.Record.GHasLink mod c sub => Servant.QueryParam.Record.GHasLink mod (GHC.Generics.D1 m c) sub instance (Servant.Links.HasLink sub, Servant.QueryParam.Record.GHasLink mod a (Servant.QueryParam.Record.GParam mod (b ()) Servant.API.Sub.:> sub)) => Servant.QueryParam.Record.GHasLink mod (a GHC.Generics.:*: b) sub instance forall k (mod :: GHC.Types.Symbol -> Fcf.Core.Exp GHC.Types.Symbol) (a :: * -> *) (sub :: k) (m :: GHC.Generics.Meta). (Servant.QueryParam.Record.GHasLink mod a sub, Servant.Links.HasLink sub) => Servant.QueryParam.Record.GHasLink mod (GHC.Generics.C1 m a) sub instance (GHC.TypeLits.KnownSymbol sym, GHC.TypeLits.KnownSymbol (Fcf.Core.Eval (mod sym)), Servant.Links.HasLink sub) => Servant.QueryParam.Record.GHasLink mod (GHC.Generics.S1 ('GHC.Generics.MetaSel ('GHC.Maybe.Just sym) d1 d2 d3) (GHC.Generics.Rec0 GHC.Types.Bool)) sub instance (GHC.TypeLits.KnownSymbol sym, GHC.TypeLits.KnownSymbol (Fcf.Core.Eval (mod sym)), Web.Internal.HttpApiData.ToHttpApiData a, Servant.Links.HasLink (a Servant.API.Sub.:> sub), Servant.Links.HasLink sub) => Servant.QueryParam.Record.GHasLink mod (GHC.Generics.S1 ('GHC.Generics.MetaSel ('GHC.Maybe.Just sym) d1 d2 d3) (GHC.Generics.Rec0 [a])) sub instance (GHC.TypeLits.KnownSymbol sym, GHC.TypeLits.KnownSymbol (Fcf.Core.Eval (mod sym)), Web.Internal.HttpApiData.ToHttpApiData a, Servant.Links.HasLink (a Servant.API.Sub.:> sub), Servant.Links.HasLink sub) => Servant.QueryParam.Record.GHasLink mod (GHC.Generics.S1 ('GHC.Generics.MetaSel ('GHC.Maybe.Just sym) d1 d2 d3) (GHC.Generics.Rec0 (GHC.Maybe.Maybe a))) sub instance (GHC.TypeLits.KnownSymbol sym, GHC.TypeLits.KnownSymbol (Fcf.Core.Eval (mod sym)), Web.Internal.HttpApiData.ToHttpApiData a, Servant.Links.HasLink (a Servant.API.Sub.:> sub), Servant.Links.HasLink sub) => Servant.QueryParam.Record.GHasLink mod (GHC.Generics.S1 ('GHC.Generics.MetaSel ('GHC.Maybe.Just sym) d1 d2 d3) (GHC.Generics.Rec0 a)) sub