-
-
Notifications
You must be signed in to change notification settings - Fork 413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is DeepQuery missing a HasLink instance? #1784
Comments
cc @divarvel |
@tchoutri @divarvel does this look good to raise a PR (except the instance (KnownSymbol sym, ToDeepQuery record, HasLink sub) => HasLink (DeepQuery sym record :> sub) where
type MkLink (DeepQuery sym record :> sub) a =
record -> MkLink sub a
-- toLink :: (Link -> a) -> Proxy endpoint -> Link -> MkLink endpoint a
toLink toA _ lnk record =
toLink toA (Proxy @sub) $ addParams lnk
where
k :: Text
k = toS $ symbolVal (Proxy @sym)
mkSingleParam x =
let (a, b) = generateDeepParam k x
in SingleParam (toS a) (toS $ escapeURIString isUnreserved $ toS $ fromMaybe "" b)
addParams lnk =
DL.foldl' (\memo x -> addQueryParam (mkSingleParam x) memo) lnk $
toDeepQuery record Also, why does |
ah yes, the missing The PR makes the choice to use I forgot a bit about the original PR, but the HasLink instance should look a lot like the HasClient instance. A PR adding HasLink support for DeepQuery should also add it to QueryString (the subtle difference is that DeepQuery qs params should be added to the query string, while QueryString qs params should replace the query string (see the difference between the two HasClient impls). |
Upgraded to
servant-server-0.20.2
to specifically use the new DeepQuery feature, however, got the following compilation error upon using it:The text was updated successfully, but these errors were encountered: