Skip to content

Commit

Permalink
update sbt-tpolecat to 0.4.4 (remove unused imports)
Browse files Browse the repository at this point in the history
  • Loading branch information
gvolpe committed Sep 3, 2023
1 parent 7e96a23 commit 8e21f26
Show file tree
Hide file tree
Showing 63 changed files with 41 additions and 153 deletions.
2 changes: 0 additions & 2 deletions modules/alerts/src/main/scala/trading/alerts/Engine.scala
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package trading.alerts

import trading.commands.TradeCommand
import trading.core.TradeEngine
import trading.domain.Alert.{ TradeAlert, TradeUpdate }
import trading.domain.AlertType.*
import trading.domain.TradingStatus.*
import trading.domain.*
import trading.events.*
import trading.lib.*
Expand Down
8 changes: 1 addition & 7 deletions modules/alerts/src/main/scala/trading/alerts/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,7 @@ import trading.state.TradeState

import cats.effect.*
import cats.syntax.all.*
import dev.profunktor.pulsar.{
Consumer as PulsarConsumer,
Producer as PulsarProducer,
Pulsar,
SeqIdMaker,
Subscription
}
import dev.profunktor.pulsar.{ Consumer as PulsarConsumer, Producer as PulsarProducer, Pulsar, Subscription }
import fs2.Stream

object Main extends IOApp.Simple:
Expand Down
2 changes: 0 additions & 2 deletions modules/core/src/main/scala/trading/core/TradeEngine.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import trading.events.TradeEvent.{ CommandExecuted, CommandRejected }
import trading.lib.FSM
import trading.state.TradeState

import cats.Id

object TradeEngine:
// Event generation and trading switch
val fsm = FSM.id[TradeState, TradeCommand | SwitchCommand, (EventId, Timestamp) => TradeEvent | SwitchEvent] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package trading.domain
import trading.Newtype

import cats.*
import cats.derived.*
import io.circe.*
import io.github.iltotore.iron.*
import io.github.iltotore.iron.cats.given
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package trading.domain

import trading.domain.*
import trading.domain.arbitraries.given
import trading.domain.cogen.given

import cats.kernel.laws.discipline.MonoidTests
import weaver.FunSuite
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import trading.domain.*
import trading.domain.generators.*

import cats.effect.IO
import cats.syntax.all.*
import io.circe.parser.decode as jsonDecode
import io.circe.syntax.*
import org.scalacheck.Gen
Expand Down
9 changes: 1 addition & 8 deletions modules/domain/shared/src/main/scala/trading/Newtype.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package trading

import java.util.UUID

import trading.domain.OrphanInstances.given

import cats.{ Eq, Order, Show }
import io.circe.{ Decoder, Encoder }
import monocle.Iso
Expand Down Expand Up @@ -46,12 +44,7 @@ abstract class IdNewtype extends Newtype[UUID]:
given IsUUID[Type] = derive[IsUUID]
def unsafeFrom(str: String): Type = apply(UUID.fromString(str))

abstract class NumNewtype[A](using
eqv: Eq[A],
ord: Order[A],
shw: Show[A],
enc: Encoder[A],
dec: Decoder[A],
abstract class NumNewtype[A: Decoder: Encoder: Eq: Order: Show](using
num: Numeric[A]
) extends Newtype[A]:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package trading.commands

import trading.domain.{ *, given }
import trading.domain.*

import cats.{ Applicative, Eq, Show }
import cats.derived.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package trading.commands

import trading.domain.{ *, given }
import trading.domain.*

import cats.{ Applicative, Eq, Show }
import cats.derived.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package trading.commands

import trading.domain.{ *, given }
import trading.domain.*

import cats.{ Applicative, Eq, Show }
import cats.derived.*
Expand Down
1 change: 0 additions & 1 deletion modules/domain/shared/src/main/scala/trading/domain.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package trading.domain

import java.time.Instant
import java.util.UUID

import scala.concurrent.duration.FiniteDuration

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package trading.domain
import cats.{ Eq, Show }
import cats.derived.*
import cats.syntax.all.*
import io.circe.{ Decoder, Encoder, Json }
import io.circe.{ Decoder, Encoder }

enum AlertType derives Eq, Show:
case StrongBuy, StrongSell, Neutral, Buy, Sell
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package trading.domain

import java.time.Instant
import java.util.UUID

import scala.concurrent.duration.{ Duration, FiniteDuration }

import cats.*
import cats.syntax.all.*
import com.comcast.ip4s.*
import io.circe.{ Decoder, Encoder }

object OrphanInstances:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package trading.domain
import cats.{ Eq, Show }
import cats.derived.*
import cats.syntax.all.*
import io.circe.{ Decoder, Encoder, Json }
import io.circe.{ Decoder, Encoder }

enum TradingStatus derives Eq, Show:
case On, Off
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package trading.domain
import cats.{ Eq, Show }
import cats.derived.*
import cats.syntax.all.*
import io.circe.{ Decoder, Encoder, Json }
import io.circe.{ Decoder, Encoder }

enum VoteResult derives Eq, Show:
case Up, Down
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package trading.events

import trading.commands.ForecastCommand
import trading.domain.*

import io.circe.Codec
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package trading.events

import trading.commands.ForecastCommand
import trading.domain.*

import io.circe.Codec
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package trading.events

import trading.commands.SwitchCommand
import trading.domain.{ *, given }
import trading.domain.*

import cats.{ Applicative, Show }
import cats.derived.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package trading.events

import trading.commands.TradeCommand
import trading.domain.{ *, given }
import trading.domain.*

import cats.{ Applicative, Eq, Show }
import cats.derived.*
Expand Down
2 changes: 2 additions & 0 deletions modules/feed/src/main/scala/trading/feed/Feed.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package trading.feed

import scala.concurrent.duration.*
import scala.annotation.nowarn

import trading.commands.*
import trading.domain.*
Expand Down Expand Up @@ -50,6 +51,7 @@ object Feed:

// This implementation is quite random, generating a lot of AuthorNotFound errors downstream
// Prefer the ForecastFeed implementation (running directly from Main) for a more realistic simulation
@nowarn
val forecasting: F[Unit] =
forecastCommandListGen.replicateA(2).flatten.traverse_ { cmd =>
import ForecastCommand.*
Expand Down
20 changes: 1 addition & 19 deletions modules/feed/src/main/scala/trading/feed/ForecastFeed.scala
Original file line number Diff line number Diff line change
@@ -1,38 +1,20 @@
package trading.feed

import java.time.Instant
import java.util.UUID

import scala.concurrent.duration.*

import trading.commands.ForecastCommand
import trading.core.AppTopic
import trading.domain.*
import trading.domain.generators.*
import trading.events.*
import trading.lib.{ *, given }
import trading.lib.*

import cats.effect.*
import cats.effect.syntax.all.*
import cats.syntax.all.*
import dev.profunktor.pulsar.{ Producer as PulsarProducer, Pulsar, Subscription, Topic }
import fs2.Stream

object ForecastFeed:
private val sub =
Subscription.Builder
.withName("forecasts-gen")
.withType(Subscription.Type.Exclusive)
.build

private def settings[A: Shard](name: String) =
PulsarProducer
.Settings[IO, A]()
.withDeduplication
.withName(s"forecast-gen-$name-command")
.withShardKey(Shard[A].key)
.some

// The randomness of randomUUID() seems better than that of Gen.uuid
def makeCmdId = CommandId(UUID.randomUUID())

Expand Down
1 change: 0 additions & 1 deletion modules/feed/src/main/scala/trading/feed/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package trading.feed
import trading.commands.*
import trading.core.AppTopic
import trading.core.http.Ember
import trading.domain.CommandId
import trading.events.*
import trading.lib.*

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package trading.forecasts

import scala.concurrent.duration.*

import trading.domain.{ *, given }

import cats.effect.kernel.Async
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ import trading.domain.*
import trading.events.{ AuthorEvent, ForecastEvent }
import trading.forecasts.store.*
import trading.lib.*
import trading.lib.Consumer.{ Msg, MsgId }
import trading.lib.Consumer.Msg

import cats.effect.kernel.{ MonadCancelThrow, Resource }
import cats.effect.kernel.MonadCancelThrow
import cats.syntax.all.*
import fs2.Stream

trait Engine[F[_]]:
def run: Msg[ForecastCommand] => F[Unit]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ import trading.core.http.Ember
import trading.events.*
import trading.forecasts.cdc.*
import trading.forecasts.store.*
import trading.lib.{ *, given }
import trading.lib.*

import cats.effect.*
import cats.effect.syntax.all.*
import cats.syntax.all.*
import dev.profunktor.pulsar.{ Producer as PulsarProducer, Pulsar, Subscription, Topic }
import fs2.Stream
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package trading.forecasts

import scala.concurrent.duration.*

import trading.domain.*
import trading.events.ForecastEvent
import trading.forecasts.store.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package trading.forecasts.cdc

import scala.concurrent.duration.*

import trading.domain.*
import trading.events.*
import trading.lib.*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ package trading.forecasts.store

import trading.domain.*
import trading.events.AuthorEvent
import trading.lib.*

import cats.~>
import cats.effect.kernel.{ MonadCancelThrow, Resource }
import cats.syntax.all.*
import doobie.{ ConnectionIO, Transactor }
import doobie.h2.*
import doobie.implicits.*

trait AuthorStore[F[_]]:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package trading.forecasts.store

import cats.effect.kernel.{ Async, Resource }
import cats.syntax.all.*
import doobie.ExecutionContexts
import doobie.h2.H2Transactor
import org.flywaydb.core.Flyway
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import cats.~>
import cats.arrow.FunctionK
import cats.effect.kernel.{ Async, Resource }
import cats.effect.kernel.Resource.ExitCase.*
import cats.effect.syntax.all.*
import cats.syntax.all.*
import doobie.{ ConnectionIO, Transactor, WeakAsync }
import doobie.free.connection.setAutoCommit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ package trading.forecasts.store

import trading.domain.*
import trading.events.ForecastEvent
import trading.lib.*

import cats.~>
import cats.effect.kernel.{ MonadCancelThrow, Resource }
import cats.syntax.all.*
import doobie.{ ConnectionIO, Transactor }
import doobie.h2.*
import doobie.implicits.*

trait ForecastStore[F[_]]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@ import java.util.UUID

import trading.IsUUID
import trading.commands.ForecastCommand
import trading.domain.TradingStatus.*
import trading.domain.*
import trading.events.*
import trading.forecasts.store.*
import trading.lib.*
import trading.lib.Consumer.{ Msg, MsgId }
import trading.lib.Logger.NoOp.given
import trading.state.*

import cats.data.NonEmptyList
import cats.effect.IO
import cats.effect.kernel.{ Ref, Resource }
import cats.syntax.all.*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,16 @@ package trading.forecasts
import java.time.Instant
import java.util.UUID

import trading.IsUUID
import trading.domain.TradingStatus.*
import trading.domain.*
import trading.events.*
import trading.forecasts.store.*
import trading.lib.*
import trading.lib.Consumer.{ Msg, MsgId }
import trading.lib.Logger.NoOp.given
import trading.state.*

import cats.data.NonEmptyList
import cats.effect.IO
import cats.effect.kernel.{ Ref, Resource }
import cats.effect.syntax.all.*
import cats.syntax.all.*
import weaver.{ Expectations, SimpleIOSuite }
import weaver.scalacheck.Checkers
Expand Down
2 changes: 1 addition & 1 deletion modules/lib/src/main/scala/trading/lib/Compaction.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import trading.domain.{ Alert, PriceUpdate }
import trading.events.SwitchEvent

import cats.syntax.all.*
import dev.profunktor.pulsar.{ MessageKey, ShardKey }
import dev.profunktor.pulsar.MessageKey

/**
* A compaction key corresponds to the (partitioning) `key` of a Pulsar `Message`, which is used for topic compaction
Expand Down
Loading

0 comments on commit 8e21f26

Please sign in to comment.