Tweak the HasLink instance for QueryParam, fixes #129
This commit is contained in:
parent
9b9ea1059c
commit
e8bae7d035
1 changed files with 4 additions and 4 deletions
|
@ -273,10 +273,10 @@ instance (KnownSymbol sym, HasLink sub) => HasLink (sym :> sub) where
|
||||||
-- QueryParam instances
|
-- QueryParam instances
|
||||||
instance (KnownSymbol sym, ToText v, HasLink sub)
|
instance (KnownSymbol sym, ToText v, HasLink sub)
|
||||||
=> HasLink (QueryParam sym v :> sub) where
|
=> HasLink (QueryParam sym v :> sub) where
|
||||||
type MkLink (QueryParam sym v :> sub) = v -> MkLink sub
|
type MkLink (QueryParam sym v :> sub) = Maybe v -> MkLink sub
|
||||||
toLink _ l v =
|
toLink _ l mv =
|
||||||
toLink (Proxy :: Proxy sub)
|
toLink (Proxy :: Proxy sub) $
|
||||||
(addQueryParam (SingleParam k (toText v)) l)
|
maybe id (addQueryParam . SingleParam k . toText) mv l
|
||||||
where
|
where
|
||||||
k :: String
|
k :: String
|
||||||
k = symbolVal (Proxy :: Proxy sym)
|
k = symbolVal (Proxy :: Proxy sym)
|
||||||
|
|
Loading…
Reference in a new issue