Skip to content

Commit

Permalink
Scala update adaptations
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Chapuis authored and jchapuis committed Sep 5, 2024
1 parent 1848d1d commit 23fea62
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ final case class AccountState(
case Some(PendingTransfers.AtLeastOneIncoming(transfers)) =>
NonEmptyList
.fromList(transfers.filterNot(_.id === id))
.map(PendingTransfers.AtLeastOneIncoming)
.map(PendingTransfers.AtLeastOneIncoming.apply)
case None => None
},
transferHistory = transferHistory + id
Expand All @@ -52,7 +52,7 @@ final case class AccountState(
case Some(PendingTransfers.AtLeastOneIncoming(transfers)) =>
NonEmptyList
.fromList(transfers.filterNot(_.id === id))
.map(PendingTransfers.AtLeastOneIncoming)
.map(PendingTransfers.AtLeastOneIncoming.apply)
case None => None
},
balance = pendingTransfers match {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import cats.syntax.eq.*
import cats.syntax.show.*
import cats.syntax.functor.*
import cats.syntax.flatMap.*
import cats.conversions.all.*
import endless.\/
import endless.core.entity.Entity
import endless.transaction.example.algebra.Account
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ trait Generators {
} yield AccountState.PendingTransfer.Incoming(id, amount)

val pendingSingleOutgoingTransferGen: Gen[AccountState.PendingTransfers.SingleOutgoing] =
pendingOutgoingTransferGen.map(AccountState.PendingTransfers.SingleOutgoing)
pendingOutgoingTransferGen.map(AccountState.PendingTransfers.SingleOutgoing.apply)

val pendingAtLeastOneIncomingTransferGen: Gen[AccountState.PendingTransfers.AtLeastOneIncoming] =
for {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class AccountEventApplierSuite extends munit.ScalaCheckSuite with Generators {
case PendingTransfers.AtLeastOneIncoming(transfers) =>
NonEmptyList
.fromList(transfers.filterNot(_.id === pendingTransfer.id))
.map(PendingTransfers.AtLeastOneIncoming)
.map(PendingTransfers.AtLeastOneIncoming.apply)
},
transferHistory = Set(pendingTransfer.id)
)
Expand All @@ -126,7 +126,7 @@ class AccountEventApplierSuite extends munit.ScalaCheckSuite with Generators {
case PendingTransfers.AtLeastOneIncoming(transfers) =>
NonEmptyList
.fromList(transfers.filterNot(_.id === pendingTransfer.id))
.map(PendingTransfers.AtLeastOneIncoming)
.map(PendingTransfers.AtLeastOneIncoming.apply)
case PendingTransfers.SingleOutgoing(_) => None
}
applier.apply(Some(state), AccountEvent.TransferAborted(pendingTransfer.id)) == Right(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@ private[transaction] final class ShardedCoordinator[F[_]: Logger, TID, BID, Q, R
branch: BID,
otherBranches: BID*
): Resource[F, Transaction[F, BID, Q, R]] =
Resource.eval(
Logger[F].debug(show"Creating transaction $id") >>
sharding
.entityFor(id)
.create(id, query, NonEmptyList.of[BID](branch, otherBranches*))
)
>>= {
Resource
.eval(
Logger[F].debug(show"Creating transaction $id") >>
sharding
.entityFor(id)
.create(id, query, NonEmptyList.of[BID](branch, otherBranches*))
)
.flatMap {
case Right(_) =>
Resource.eval(
Logger[F].debug(show"Transaction transaction $id successfully created")
Expand Down

0 comments on commit 23fea62

Please sign in to comment.