Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'testWithApplication'' function #843

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on May 13, 2021

  1. Add 'testWithApplication'' function

    Same as `testWithApplication` but accepts `Application` as a pure argument
    The requirement of `testWithApplication` to pass `Application` parameter in wrapped in `IO` monad seems unnecessary strict:
    Apparently the only action `testWithApplicationSettings` (the underlying implementation) does is to unwrap it with:
    ```haskell
    testWithApplicationSettings :: Settings -> IO Application -> (Port -> IO a) -> IO a
    testWithApplicationSettings settings mkApp action = do
      callingThread <- myThreadId
      app <- mkApp
      let wrappedApp request respond =
            app request respond `catch` \ e -> do
      [truncated]
    ```
    
    into `app` which can be done outside of  `testWithApplication'` with:
    
    ```haskell
    testWithApplication :: IO Application -> (Port -> IO a) -> IO a
    testWithApplication mkApp action =
      mkApp >>= flip testWithApplication' action
    ```
    EduardSergeev committed May 13, 2021
    Configuration menu
    Copy the full SHA
    2322225 View commit details
    Browse the repository at this point in the history