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

[WIP] monadless for doobie's ConnectionIO #7

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

Conversation

szimano
Copy link

@szimano szimano commented Jul 23, 2018

New feature.

Problem

This is a monadless instance for a popular pure DB connector doobie https://github.com/tpolecat/doobie

Solution

Wrote MonadlessConnectionIO

Notes

One thing i could not find reasons for is:

I've copied tests from the monix.Task monadless instance and with the rescue test originally I had it as

"rescue" - {
    "success" in
      runLiftTest(1) {
        try unlift(one)
        catch {
          case e: Throwable => unlift(two)
        }
      }
    "failure" in
      runLiftTest(1337) {
        try fail[Int]
        catch {
          case e: Exception => unlift(queryInt(1337))
        }
      }
  }

And this never called rescue in failure. Chanigng it to

"rescue" - {
    "success" in
      runLiftTest(1) {
        try unlift(one)
        catch {
          case e: Throwable => unlift(two)
        }
      }
    "failure" in
      runLiftTest(1337) {
        try unlift(two) / fail[Int]
        catch {
          case e: Exception => unlift(queryInt(1337))
        }
      }
  }

Calls rescue properly and makes the code pass.

What am I missing here? Marking the code as WIP for that reason. Otherwise i have it in my production code and it works well.

Checklist

  • Unit test all changes
  • Update README.md if applicable
  • Add [WIP] to the pull request title if it's work in progress
  • Squash commits that aren't meaningful changes
  • Run sbt scalariformFormat test:scalariformFormat to make sure that the source files are formatted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant