Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions modules/core/src/main/scala/doobie/util/transactor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -300,19 +300,19 @@ object transactor {
def interpret[M[_]]: Transactor[M] `Lens` Interpreter[M] = Lens(_.interpret, (a, b) => a.copy(interpret0 = b))

/** @group Lenses */
def strategy[M[_]]: Transactor[M] `Lens` Strategy = Lens(_.strategy, (a, b) => a.copy(strategy0 = b))
def strategy[M[_], A]: Transactor.Aux[M, A] `Lens` Strategy = Lens(_.strategy, (a, b) => a.copy(strategy0 = b))

/** @group Lenses */
def before[M[_]]: Transactor[M] `Lens` ConnectionIO[Unit] = strategy[M] >=> Strategy.before
def before[M[_], A]: Transactor.Aux[M, A] `Lens` ConnectionIO[Unit] = strategy[M, A] >=> Strategy.before

/** @group Lenses */
def after[M[_]]: Transactor[M] `Lens` ConnectionIO[Unit] = strategy[M] >=> Strategy.after
def after[M[_], A]: Transactor.Aux[M, A] `Lens` ConnectionIO[Unit] = strategy[M, A] >=> Strategy.after

/** @group Lenses */
def oops[M[_]]: Transactor[M] `Lens` ConnectionIO[Unit] = strategy[M] >=> Strategy.oops
def oops[M[_], A]: Transactor.Aux[M, A] `Lens` ConnectionIO[Unit] = strategy[M, A] >=> Strategy.oops

/** @group Lenses */
def always[M[_]]: Transactor[M] `Lens` ConnectionIO[Unit] = strategy[M] >=> Strategy.always
def always[M[_], A]: Transactor.Aux[M, A] `Lens` ConnectionIO[Unit] = strategy[M, A] >=> Strategy.always

/** Construct a constructor of `Transactor[M, D]` for some `D <: DataSource` When calling this constructor you
* should explicitly supply the effect type M e.g. Transactor.fromDataSource[IO](myDataSource, connectEC)
Expand Down
4 changes: 2 additions & 2 deletions modules/example/src/main/scala/example/StreamingCopy.scala
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ object StreamingCopy extends IOApp.Simple {
HC.delay(Console.println(s"$tag: $s")) <* _

/** Derive a new transactor that logs stuff. */
def addLogging[F[_], A](name: String)(xa: Transactor[F]): Transactor[F] = {
def addLogging[F[_], A](name: String)(xa: Transactor.Aux[F, A]): Transactor.Aux[F, A] = {
import Transactor.* // bring the lenses into scope
val update: State[Transactor[F], Unit] =
val update: State[Transactor.Aux[F, A], Unit] =
for {
_ <- before %= printBefore(name, "before - setting up the connection")
_ <- after %= printBefore(name, "after - committing")
Expand Down