I didn't exhaustively test, but at least :load src/main/scala/ch06_TvShows.scala loaded properly.
Looks like issues with using java implementations.
On a related note, in ch06_TvShows.scala there are multiple implementations of the same function (eg. extractName has Option, Either, Option, Either 4 appearances).
How do I know which version got loaded?
I read online that it's the last one that gets loaded, so i expect def extractName(rawShow: String): Either[String, String] from line 409 , but i got the Option version instead?
scala> ch06_TvShows.extractName
val res92: String => Option[String] = Lambda$7587/0x0000000802189fd8@707b5dea
Output for error loading chapter 8
scala> :load src/main/scala/ch08_SchedulingMeetings.scala
-- [E007] Type Mismatch Error: -------------------------------------------------
23 | ch08_SchedulingMeetingsAPI.calendarEntriesApiCall(name).asScala.toList
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| Found: List[MeetingTime]
| Required: List[MeetingTime²]
|
| where: MeetingTime is a class
| MeetingTime² is a class
|----------------------------------------------------------------------------
| Explanation (enabled by `-explain`)
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
| Tree: jdk.CollectionConverters.ListHasAsScala[MeetingTime](
| ch08_SchedulingMeetingsAPI.calendarEntriesApiCall(name)
| ).asScala.toList
| I tried to show that
| List[MeetingTime]
| conforms to
| List[MeetingTime]
| but the comparison trace ended with `false`:
|
| ==> List[MeetingTime] <: List[MeetingTime]
| ==> MeetingTime <: MeetingTime
| <== MeetingTime <: MeetingTime = false
| <== List[MeetingTime] <: List[MeetingTime] = false
|
| The tests were made under the empty constraint
----------------------------------------------------------------------------
-- [E007] Type Mismatch Error: -------------------------------------------------
28 | ch08_SchedulingMeetingsAPI.createMeetingApiCall(names.asJava, meetingTime)
| ^^^^^^^^^^^
| Found: (meetingTime : MeetingTime)
| Required: MeetingTime²
|
| where: MeetingTime is a class
| MeetingTime² is a class
|----------------------------------------------------------------------------
| Explanation (enabled by `-explain`)
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
| Tree: meetingTime
| I tried to show that
| (meetingTime : MeetingTime)
| conforms to
| MeetingTime
| but the comparison trace ended with `false`:
|
| ==> (meetingTime : MeetingTime) <: MeetingTime
| ==> MeetingTime <: MeetingTime (left is approximated)
| <== MeetingTime <: MeetingTime (left is approximated) = false
| <== (meetingTime : MeetingTime) <: MeetingTime = false
|
| The tests were made under the empty constraint
----------------------------------------------------------------------------
2 errors found
Suggested improvements
I suggest changing scalacOptions ++= List("-unchecked"), to scalacOptions ++= List("-unchecked", "-deprecation", "-explain"), because both extra options have helped me understand outputs and enriches the learning experience, especially -explain. Maybe there are other helpful options i'm unaware of too.
I tried many loading many files from chapter 1 to 8 and everything worked except ch08_SchedulingMeetings.scala.
@gitgithan: did you find a solution to load the file?
I didn't exhaustively test, but at least
:load src/main/scala/ch06_TvShows.scala
loaded properly.Looks like issues with using java implementations.
On a related note, in
ch06_TvShows.scala
there are multiple implementations of the same function (eg.extractName
has Option, Either, Option, Either 4 appearances). How do I know which version got loaded? I read online that it's the last one that gets loaded, so i expectdef extractName(rawShow: String): Either[String, String]
from line 409 , but i got the Option version instead?Output for error loading chapter 8
Suggested improvements
I suggest changing
scalacOptions ++= List("-unchecked"),
toscalacOptions ++= List("-unchecked", "-deprecation", "-explain"),
because both extra options have helped me understand outputs and enriches the learning experience, especially -explain. Maybe there are other helpful options i'm unaware of too.