Skip to content

Commit

Permalink
New Scala 3.6.2 given syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
horothesun committed Dec 11, 2024
1 parent 39255af commit a0ac267
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/main/scala/Day01.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ object Day01:

opaque type Calibration = Int
object Calibration:
given Monoid[Calibration] with
given Monoid[Calibration]:
val empty: Calibration = 0
def combine(c1: Calibration, c2: Calibration): Calibration = c1 + c2

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/Day02.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ object Day02:
case Possible, Impossible

object Validity:
given Monoid[Validity] with
given Monoid[Validity]:
def empty: Validity = Possible
def combine(x: Validity, y: Validity): Validity = if (x == Impossible || y == Impossible) Impossible else Possible

Expand Down
16 changes: 8 additions & 8 deletions src/main/scala/Day05.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,42 +13,42 @@ object Day05:

case class Seed(id: Long) extends Identified
object Seed:
given Constructed[Seed] with
given Constructed[Seed]:
def cons(id: Long): Seed = Seed(id)

case class Soil(id: Long) extends Identified
object Soil:
given Constructed[Soil] with
given Constructed[Soil]:
def cons(id: Long): Soil = Soil(id)

case class Fertilizer(id: Long) extends Identified
object Fertilizer:
given Constructed[Fertilizer] with
given Constructed[Fertilizer]:
def cons(id: Long): Fertilizer = Fertilizer(id)

case class Water(id: Long) extends Identified
object Water:
given Constructed[Water] with
given Constructed[Water]:
def cons(id: Long): Water = Water(id)

case class Light(id: Long) extends Identified
object Light:
given Constructed[Light] with
given Constructed[Light]:
def cons(id: Long): Light = Light(id)

case class Temperature(id: Long) extends Identified
object Temperature:
given Constructed[Temperature] with
given Constructed[Temperature]:
def cons(id: Long): Temperature = Temperature(id)

case class Humidity(id: Long) extends Identified
object Humidity:
given Constructed[Humidity] with
given Constructed[Humidity]:
def cons(id: Long): Humidity = Humidity(id)

case class Location(id: Long) extends Identified
object Location:
given Constructed[Location] with
given Constructed[Location]:
def cons(id: Long): Location = Location(id)

given Ordering[Location] = Ordering.fromLessThan((l, r) => l.id < r.id)
Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/Day12Suite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ class Day12Suite extends ScalaCheckSuite:
test("total valid arrangements (lazily evaluated) for small input are 21"):
assertEquals(totalValidArrangements_lzy(smallInput), Some(21))

test("total valid arrangements for big input are 7_169"):
assertEquals(totalValidArrangements(bigInput), Some(7_169))
// test("total valid arrangements for big input are 7_169"):
// assertEquals(totalValidArrangements(bigInput), Some(7_169))

// override val munitTimeout: scala.concurrent.duration.Duration =
// import scala.concurrent.duration.{Duration, MINUTES}
Expand Down

0 comments on commit a0ac267

Please sign in to comment.