Skip to content

Instantly share code, notes, and snippets.

@dminuoso

dminuoso/t.hs Secret

Last active October 9, 2022 22:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dminuoso/0b9db8bcf0c92e8861640f46a6e1b735 to your computer and use it in GitHub Desktop.
Save dminuoso/0b9db8bcf0c92e8861640f46a6e1b735 to your computer and use it in GitHub Desktop.
import Control.Monad.IO.Class (liftIO)
type MyApplication = Request
-> (Response -> ReaderT Env IO ResponseReceived)
-> ReaderT Env IO ResponseReceived
mkApp :: Env -> MyApplication -> Application
mkApp env app req respond = flip runReaderT env $
app req (\r -> ReaderT (\_ -> respond r))
mkApp2 :: Env -> MyApplication -> Application
mkApp2 env app req respond = flip runReaderT env $
app req (liftIO . respond)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment