Hi,
if possible, I'd like to use web server continuations with `(send/suspend/dispatch...)`. However, currently I need to return something of type `response?`, but when send/suspend/dispatch (and friends) don't return a response - they send it to the client and return `Any` (or other types).
The question is: is this even possible to get working when my servlet expects a response back? And if not, is there some clever way to make it work anyway - typing things differently? I think that I won't go down the road of using different types, since sometimes I want to use a function that returns a response directly, rather than via web continuations.
The cod so far:
```{module that creates the response}
#lang typed/racket
(require typed/web-server/http)
(define-type EmbedURL (-> (-> request Any) String))
(define-type ResponseMaker (-> EmbedURL response))
(require/typed web-server/servlet
[send/suspend/dispatch (-> ResponseMaker Any)])
(define continuation-servlet
(λ (req)
(: response-generator ResponseMaker)
(define (response-generator embed/url)
(response/wrap-xexpr
#:title text
#:wrap-body? #t
#:xexpr `(body (h1 ,text)
,(if when-done
(next-button (λ () (when-done (state-response 'next 'display-page)))
embed/url)
'(p "Thanks and goodbye"))
)))
(send/suspend/dispatch response-generator))))
```
which gets called elsewhere in a non-typed module via `(continuation-servlet req)`, which has the wrong type. I could simply claim that the returned type is response (it's thrown away anyway, I think), but that seems wrong at the conceptual level.
Thanks for any pointers as to how to make this work - or why not to try to make it work.
Cheers,
Marc