In servant-server, it is impossible for a user-defined handler to inspect the request and to mess with the response. Since servant-snap uses any MonadSnap m => m a as the handler monad, we lose this guarantee, making it possible to branch on runtime information in the request and to call functions like writeText that impurely modify the response.
The goal of running in a restrictive monad like servant-server's Handler' is to ensure that all HTTP logic is determined by the type of the API. We should provide that functionality inservant-snap` for users that want this level of safety in their API handlers.
It's not clear how this would interact with Snaplets ability to provide use values (db connections, local state, etc.)
In
servant-server
, it is impossible for a user-defined handler to inspect the request and to mess with the response. Sinceservant-snap
uses anyMonadSnap m => m a
as the handler monad, we lose this guarantee, making it possible to branch on runtime information in the request and to call functions likewriteText
that impurely modify the response.The goal of running in a restrictive monad like
servant-server
'sHandler' is to ensure that all HTTP logic is determined by the type of the API. We should provide that functionality in
servant-snap` for users that want this level of safety in their API handlers.It's not clear how this would interact with
Snaplet
s ability to provide use values (db connections, local state, etc.)