Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ c4e40ce6ba60f40aadcfb9c040eea0aee1d30ad7

# Scala Steward: Reformat with scalafmt 3.8.5
2f568e14560da04932b281f628b1f116d552aabb

# Scala Steward: Reformat with scalafmt 3.9.10
27b30ec0d2fe03f7a1809b3655883f368b4f2cba
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 3.9.4
version = 3.9.10
runner.dialect = scala3
style = default
maxColumn = 120
Expand Down
8 changes: 4 additions & 4 deletions src/main/scala/ch06_TvShows.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ object ch06_TvShows extends App {
def sortShows(shows: List[TvShow]): List[TvShow] = {
shows
.sortBy(tvShow => tvShow.end - tvShow.start) // sortBy gets a function that returns an Int for a given TvShow
.reverse // sortBy sorts in natural order (from the smallest Int to the highest one), so we return a reverse of the List
.reverse // sortBy sorts in natural order (from the smallest Int to the highest one), so we return a reverse of the List
}

assert(sortShows(shows).map(_.title) == List("Mad Men", "The Wire", "Breaking Bad"))
Expand Down Expand Up @@ -259,10 +259,10 @@ object ch06_TvShows extends App {

{ // STEP 2a: trying to blindly implement parseShows by following only the compiler ("best-effort" error handling strategy)
def parseShows(rawShows: List[String]): List[TvShow] = {
rawShows // List[String]
rawShows // List[String]
.map(parseShow) // List[Option[TvShow]]
.map(_.toList) // List[List[TvShow]]
.flatten // List[TvShow]
.map(_.toList) // List[List[TvShow]]
.flatten // List[TvShow]
}

{ // example from the introduction to this section
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/ch07_MusicArtistsSearch.scala
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ object ch07_MusicArtistsSearch extends App {
.contains(artist.origin.name)) && // <- using Location
(!searchByActiveYears ||
(artist.isActive || artist.yearsActiveEnd.value >= activeAfter) && // <- using YearsActiveEnd
artist.yearsActiveStart.value <= activeBefore) // <- using YearsActiveStart
artist.yearsActiveStart.value <= activeBefore) // <- using YearsActiveStart
)
}

Expand Down Expand Up @@ -315,7 +315,7 @@ object ch07_MusicArtistsSearch extends App {
(locations.isEmpty || locations.contains(artist.origin.name)) &&
(!searchByActiveYears ||
artist.yearsActive.end.forall(_ >= activeAfter) && // <- using new product type (end)
artist.yearsActive.start <= activeBefore) // <- using new product type (start)
artist.yearsActive.start <= activeBefore) // <- using new product type (start)
)
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/ch10_CheckIns.scala
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ object ch10_CheckIns {
checkIns
.scan(Map.empty[City, Int])((cityCheckIns, city) =>
cityCheckIns.updatedWith(city)(_.map(_ + 1).orElse(Some(1)))
) // introduce updatedWith
) // introduce updatedWith
.map(topCities)
.foreach(IO.println) // introduce IO.println
.compile
Expand Down
Loading