remove optional braces

This commit is contained in:
Mark Canlas 2023-10-23 13:56:45 -04:00
parent 2ac62b5af7
commit 0ed2062e5b
5 changed files with 13 additions and 11 deletions

View File

@ -50,3 +50,4 @@ includeNoParensInSelectChains = true
optIn.breakChainOnFirstMethodDot = true optIn.breakChainOnFirstMethodDot = true
rewrite.scala3.convertToNewSyntax = true rewrite.scala3.convertToNewSyntax = true
rewrite.scala3.removeOptionalBraces = true

View File

@ -37,9 +37,9 @@ object PrintPrograms extends ZIOAppDefault:
) )
def run: Task[Unit] = def run: Task[Unit] =
for { for
// just a traverse in slow motion... // just a traverse in slow motion...
_ <- programs _ <- programs
.map { case (f, xs) => File(s"data/$f").writeLines(xs) } .map { case (f, xs) => File(s"data/$f").writeLines(xs) }
.foldLeft[Task[Unit]](ZIO.unit)((acc, z) => acc *> z) .foldLeft[Task[Unit]](ZIO.unit)((acc, z) => acc *> z)
} yield () yield ()

View File

@ -90,10 +90,10 @@ object MatchOpcodes:
out.print("<th/>") out.print("<th/>")
val fancyColumns = val fancyColumns =
for { for
c <- 0 to 3 c <- 0 to 3
b <- 0 to 7 b <- 0 to 7
} yield b * 4 + c yield b * 4 + c
for f <- fancyColumns do out.print(s"<th>${paddedBinary(f, 8)}</th>") for f <- fancyColumns do out.print(s"<th>${paddedBinary(f, 8)}</th>")
@ -170,11 +170,11 @@ object MatchOpcodes:
out.print("<th/>") out.print("<th/>")
val columns = val columns =
for { for
y <- 0 to 1 y <- 0 to 1
x <- 0 to 1 x <- 0 to 1
z <- 0 to 1 z <- 0 to 1
} yield (z << 2) + (x << 1) + y yield (z << 2) + (x << 1) + y
val rows = val rows =
0 to 7 0 to 7
@ -207,11 +207,11 @@ object MatchOpcodes:
out.print("</table>") out.print("</table>")
def wideColumns: Seq[Int] = def wideColumns: Seq[Int] =
for { for
cc <- 0 to 3 cc <- 0 to 3
y <- 0 to 1 y <- 0 to 1
xx <- 0 to 3 xx <- 0 to 3
} yield (xx << 3) + (y << 2) + cc yield (xx << 3) + (y << 2) + cc
def wideRows: Seq[Int] = def wideRows: Seq[Int] =
0 to 7 0 to 7

View File

@ -20,11 +20,11 @@ trait BitExtractor[A]:
def length: Int = self.length + that.length def length: Int = self.length + that.length
def unapply(n: Int): Option[(A, B)] = def unapply(n: Int): Option[(A, B)] =
for { for
b <- that.unapply(n) b <- that.unapply(n)
shifted = n >> that.length shifted = n >> that.length
a <- self.unapply(shifted) a <- self.unapply(shifted)
} yield (a, b) yield (a, b)
object AtomExtractor: object AtomExtractor:
@tailrec @tailrec

View File

@ -1,6 +1,7 @@
package com.htmlism.mos6502.model package com.htmlism.mos6502.model
sealed trait Instruction { def theme: String; def color: String } sealed trait Instruction:
def theme: String; def color: String
case object NoInstruction extends Instruction: case object NoInstruction extends Instruction:
def theme: String = "noop"; def color: String = "white" def theme: String = "noop"; def color: String = "white"