-
Does a rule like this exist? Scala 3 provides the I would love to have a configuration like the following: runner.dialect = scala3
style = defaultWithAlign
rewrite {
scala3 {
convertToNewSyntax = true
removeOptionalBraces = true
convertImplicitsToNewSyntax = true
}
trailingCommas.style = never
} Where given the following Scala code: final case class Person(age: Int)
implicit val showPerson: Show[Person] = Show.fromToString
trait Log[F[_]] {
def info(msg: => String): F[Unit]
}
object Log {
def apply[F[_]: Log]: Log[F] = implicitly
object NoOp {
implicit def instance[F[_]: Applicative]: Log[F] =
new Log[F] {
def info(msg: => String): F[Unit] = Applicative[F].unit
}
}
}
trait Log2[F[_]] {
def info(msg: => String): F[Unit]
def error(msg: => String): F[Unit]
}
object Log2 {
def apply[F[_]: Log2]: Log2[F] = implicitly
object NoOp {
implicit def instance[F[_]: Applicative]: Log2[F] =
new Log2[F] {
def info(msg: => String): F[Unit] = Applicative[F].unit
def error(msg: => String): F[Unit] = Applicative[F].unit
}
}
} It would produce the following formatted code: final case class Person(age: Int)
given Show[Person] = Show.fromToString
trait Log[F[_]]:
def info(msg: => String): F[Unit]
object Log:
def apply[F[_]: Log]: Log[F] = summon
object NoOp:
given [F[_]: Applicative]: Log[F] with
def info(msg: => String): F[Unit] = Applicative[F].unit
trait Log2[F[_]]:
def info(msg: => String): F[Unit]
def error(msg: => String): F[Unit]
object Log2:
def apply[F[_]: Log2]: Log2[F] = summon
object NoOp:
given [F[_]: Applicative]: Log2[F] = new:
def info(msg: => String): F[Unit] = Applicative[F].unit
def error(msg: => String): F[Unit] = Applicative[F].unit |
Beta Was this translation helpful? Give feedback.
Answered by
tgodzik
Feb 29, 2024
Replies: 1 comment 2 replies
-
no, it doesn't exist. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This should probably be a warning with actionable diagnostic coming from the compiler. We could then apply i automatically.