haskell-servant / haskell-servant/servant
How to get access to client functions when passing params to hoistClient
- Dominant language
- Haskell
- Stars
- 2k
- Forks
- 427
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 5
Description
following the documentation here: https://haskell-servant.readthedocs.io/en/stable/tutorial/Client.html#changing-the-monad-the-client-functions-live-in
you end up with
```
-- our conversion function has type: forall a. ClientM a -> IO a
-- the result has type:
-- Client IO HoistClientAPI = IO Int :<|> (Int -> IO Int)
getClients :: ClientEnv -> Client IO HoistClientAPI
getClients clientEnv
= hoistClient hoistClientAPI
( fmap (either (error . show) id)
. flip runClientM clientEnv
)
(client hoistClientAPI)
```
How do you access the client functions?
I tried something like this, but I get a parse error.
```
(clientEnv (getInt :<|> postInt)) = hoistClient hoistClientAPI
( fmap (either (error . show) id)
. flip runClientM clientEnv
)
(client hoistClientAPI)
```
Contributor guide
Assessment
This issue has not been assessed yet.