servant-namedargs 0.1.0.0 → 0.1.0.1
raw patch · 3 files changed
+16/−12 lines, 3 files
Files
- CHANGELOG.md +4/−0
- servant-namedargs.cabal +2/−2
- src/Servant/API/NamedArgs.hs +10/−10
CHANGELOG.md view
@@ -3,3 +3,7 @@ ## 0.1.0.0 -- 2019-01-23 * First version.++## 0.1.0.1 -- 2019-01-25++* Relaxation of base constraint and some minor documentation fixes; had to be done as a new version to be able to build on Hackage
servant-namedargs.cabal view
@@ -1,5 +1,5 @@ name: servant-namedargs-version: 0.1.0.0+version: 0.1.0.1 synopsis: Combinators for servant providing named parameters -- description: license: BSD3@@ -16,7 +16,7 @@ exposed-modules: Servant.API.NamedArgs -- other-modules: -- other-extensions:- build-depends: base >= 4.11 && < 4.12+ build-depends: base >= 4.11 && < 4.13 , servant >= 0.14.1 && < 0.16 , named >= 0.2 && < 0.3 , text >= 1.2 && < 1.3
src/Servant/API/NamedArgs.hs view
@@ -117,7 +117,7 @@ data NamedHeader' (mods :: [*]) (sym :: Symbol) (a :: *) deriving Typeable --- | Shorthand for a required Header; Isomorphism of 'Header'+-- | Shorthand for a required Header; Isomorphism of 'Servant.API.Header' type NamedHeader = NamedHeader' '[Optional, Strict] -- | Has no effect on the resulting link@@ -125,20 +125,20 @@ type MkLink (NamedHeader' mods name a :> sub) r = MkLink sub r toLink toA _ = toLink toA (Proxy :: Proxy sub) --- | Returns the type name :! a if given a list including 'Required'--- and name :? a otherwise+-- | Returns the type name ':!' a if given a list including 'Required'+-- and name ':?' a otherwise type RequiredNamedArgument mods name a = If (FoldRequired mods) (name :! a) (name :? a) --- | Returns either a `NamedF Identity` or `NamedF Maybe` depending on if--- required/optional, wrapping an `Either Text a` or an `a` depending on if+-- | Returns either a 'NamedF' 'Identity' or 'NamedF' 'Maybe' depending on if+-- required/optional, wrapping an 'Either' 'Text' a or an a depending on if -- lenient/strict type RequestNamedArgument mods name a = If (FoldRequired mods) (name :! If (FoldLenient mods) (Either Text a) a) (name :? (If (FoldLenient mods) (Either Text a) a)) --- | Apply either the function 'f' which operates on 'a'--- or 'g' which operates on 'Maybe' a depending on if the +-- | Apply either the function f which operates on a+-- or g which operates on 'Maybe' a depending on if the -- mods include `Required` foldRequiredNamedArgument :: forall mods name a r. (SBoolI (FoldRequired mods), KnownSymbol name)@@ -157,7 +157,7 @@ foldRequiredAdapter :: forall mods name a r. (SBoolI (FoldRequired mods), KnownSymbol name) => (If (FoldRequired mods) a (Maybe a) -> r) -- ^ Version of functions without named arguments- -> RequiredNamedArgument mods name a -- ^ Argument to either 'f' or 'g'+ -> RequiredNamedArgument mods name a -- ^ Argument to either f or g -> r foldRequiredAdapter f mv = case (sbool :: SBool (FoldRequired mods), mv) of@@ -226,7 +226,7 @@ type AsTransformed t mode :- api = mode :- Transform t api -- | Possible transformations 'Transform' can apply-data Transformation = NameParams -- ^ Replace 'QueryParam''s with 'NamedParam''s+data Transformation = NameParams -- ^ Replace 'QueryParam''s with 'NamedParam's | NameMultiParams -- ^ Replace 'QueryParams's with 'NamedParams's | NameCaptures -- ^ Replace 'Capture''s with 'NamedCapture''s | NameCaptureAlls -- ^ Replace 'CaptureAll's with 'NamedCaptureAll's@@ -234,7 +234,7 @@ | NameHeaders -- ^ Replace 'Header''s with 'NamedHeader''s | UnnameParams -- ^ Replace 'NamedParam's with 'QueryParam''s | UnnameMultiParams -- ^ Replace 'NamedParams's with 'QueryParams's - | UnnameCaptures -- ^ Replace 'NamedCapture''s with 'Capture's+ | UnnameCaptures -- ^ Replace 'NamedCapture''s with 'Capture''s | UnnameCaptureAlls -- ^ Replace 'NamedCaptureAll's with 'CaptureAll's | UnnameFlags -- ^ Replace 'NamedFlag's with 'QueryFlag's | UnnameHeaders -- ^ Replace 'NamedHeader''s with 'Header''s