named-servant 0.1.1 → 0.2.0
raw patch · 2 files changed
+8/−6 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- named-servant.cabal +1/−1
- src/Servant/Named.hs +7/−5
named-servant.cabal view
@@ -1,7 +1,7 @@ cabal-version: 1.12 name: named-servant description: support named parameters in servant using the named package-version: 0.1.1+version: 0.2.0 maintainer: kristof@resonata.be copyright: Kristof Bastiaensen 2020 license: BSD3
src/Servant/Named.hs view
@@ -49,6 +49,7 @@ -- | Like `QueryParams`, but extracts a named type @named `:?` [a]@ -- instead, where named corresponds to the query parameter string.+-- The default value is the empty list `[]` data NamedQueryParams (sym :: Symbol) (a :: *) instance (KnownSymbol sym, ToHttpApiData v, HasLink sub)@@ -59,14 +60,15 @@ toLink toA (Proxy :: Proxy (QueryParams sym v :> sub)) l $ fromMaybe [] params --- | Like `QueryFlag, but extracts a named type @named `:!` Bool@+-- | Like `QueryFlag, but extracts a named type @named `:?` Bool@ -- instead, where named corresponds to the query parameter string.+-- The default value is False. data NamedQueryFlag (sym :: Symbol) instance (KnownSymbol sym, HasLink sub) => HasLink (NamedQueryFlag sym :> sub) where type MkLink (NamedQueryFlag sym :> sub) a =- (sym :! Bool) -> MkLink sub a- toLink toA _ l (Arg qparam) =- toLink toA (Proxy :: Proxy (QueryFlag sym :> sub)) l qparam- + (sym :? Bool) -> MkLink sub a+ toLink toA _ l (ArgF qparam) =+ toLink toA (Proxy :: Proxy (QueryFlag sym :> sub)) l $+ fromMaybe False qparam