Skip to content

Commit

Permalink
refactor: change type parameter order
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshinorin committed May 8, 2024
1 parent 60d67a9 commit 5fd894f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/main/scala/net/yoshinorin/qualtet/actions/Action.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package net.yoshinorin.qualtet.actions

import cats.Monad

sealed trait Action[R]
final case class Continue[T, R, F[_]](request: F[T], next: T => Action[R]) extends Action[R]
final case class Continue[F[_]: Monad, R, T](request: F[T], next: T => Action[R]) extends Action[R]
final case class Done[R](value: R) extends Action[R]

object Action {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class DoobieTransactor(config: DBConfig) extends Transactor[ConnectionIO, IO] {
)

override def perform[R](action: Action[R]): ConnectionIO[R] = action match {
case continue: Continue[_, R, ConnectionIO] => continue.request.flatMap { t => perform(continue.next(t)) }
case continue: Continue[ConnectionIO, R, _] => continue.request.flatMap { t => perform(continue.next(t)) }
case done: Done[R] => done.value.pure[ConnectionIO]
}

Expand Down

0 comments on commit 5fd894f

Please sign in to comment.