I want to persist some data in StateT monad,
Within Handler of the post(any http method) function I want to modify the data stored in state... but the issue is I can't use State inside Handler...
newtype HandlerM a = HandlerM (Request -> Response -> Effect Unit -> Aff a)
type Handler = HandlerM Unit
and type of http methods are as follows,
post :: forall r. RoutePattern r => r -> Handler -> App
I want to do something like,
post "/some/api" $ do
S.modify (\s -> s { count = s.+ 1}} ---- modify state with respect to response
--- handle request
ps: I can use ref but is there any way I can use StateT inside Handler...