haskell-servant / haskell-servant/servant
Enter for Raw endpoints
- Dominant language
- Haskell
- Stars
- 2k
- Forks
- 427
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 5
Description
Agreed with @phadej to open an issue after discussion on IRC.
I have regular Get, Put, Post endpoint, but also need to make use of a raw endpoint and I would like to access my `Reader` environment from the raw handler the same way that I can do it for regular servant handlers, but that is currently not possible. E.g. in the simplified example below from the handler of type `Application` I would like to ask for any of the config information e.g. database connection.
```
type Api = Raw
api :: ServerT Api MyHandler
api = Tagged $ handler
where
handler :: Application
handler = do
conn <- asks cfgDatabaseConnection -- currently not possible
runDB conn query
server :: Config -> Server Api
server cfg = enter (runReaderTNat cfg :: MyHandler :~> Handler) api
```
Contributor guide
Assessment
This issue has not been assessed yet.