Skip to content

Commit c3f9937

Browse files
committed
Updated to Scala 2.13.1
1 parent 4bed23b commit c3f9937

8 files changed

Lines changed: 38 additions & 28 deletions

File tree

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import ProjectPlugin.autoImport._
22

3-
val scalaExercisesV = "0.5.0-SNAPSHOT"
3+
val scalaExercisesV = "0.6.0-SNAPSHOT"
44

55
def dep(artifactId: String) = "org.scala-exercises" %% artifactId % scalaExercisesV
66

project/ProjectPlugin.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ object ProjectPlugin extends AutoPlugin {
1515
object autoImport {
1616

1717
lazy val V = new {
18-
val scala212: String = "2.12.10"
18+
val scala213: String = "2.13.1"
1919
val cats: String = "2.0.0"
2020
val shapeless: String = "2.3.3"
2121
val scalatest: String = "3.1.0"
@@ -41,14 +41,14 @@ object ProjectPlugin extends AutoPlugin {
4141
organizationEmail = "hello@47deg.com"
4242
),
4343
orgLicenseSetting := ApacheLicense,
44-
scalaVersion := V.scala212,
44+
scalaVersion := V.scala213,
4545
scalaOrganization := "org.scala-lang",
4646
resolvers ++= Seq(
4747
Resolver.mavenLocal,
4848
Resolver.sonatypeRepo("snapshots"),
4949
Resolver.sonatypeRepo("releases")
5050
),
51-
scalacOptions := scalacCommonOptions ++ scalacLanguageOptions ++ Seq("-Ypartial-unification"),
51+
scalacOptions := scalacCommonOptions ++ scalacLanguageOptions,
5252
headerLicense := Some(Custom(s"""| scala-exercises - ${name.value}
5353
| Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
5454
|

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.2.8
1+
sbt.version=1.3.5

project/plugins.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ resolvers ++= Seq(
22
Resolver.sonatypeRepo("snapshots")
33
)
44

5-
addSbtPlugin("org.scala-exercises" % "sbt-exercise" % "0.5.0-SNAPSHOT")
5+
addSbtPlugin("org.scala-exercises" % "sbt-exercise" % "0.6.0-SNAPSHOT")
66
addSbtPlugin("com.47deg" % "sbt-org-policies" % "0.12.0-M3")

src/main/scala/fetchlib/ErrorHandlingSection.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ import org.scalatest.matchers.should.Matchers
1919
* Fetch is used for reading data from remote sources and the queries we perform can and will fail at some point.
2020
* There are many things that can go wrong:
2121
*
22-
* - an exception can be thrown by client code of certain data sources
23-
* - an identity may be missing
24-
* - the data source may be temporarily available
22+
* - an exception can be thrown by client code of certain data sources
23+
* - an identity may be missing
24+
* - the data source may be temporarily available
2525
*
2626
* Since the error cases are plenty and can’t be anticipated Fetch errors are represented by the 'FetchException'
2727
* trait, which extends `Throwable`.

src/main/scala/fetchlib/FetchTutorialHelper.scala

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ object FetchTutorialHelper {
5656
latency[F](s"One User $id") >> CF.pure(userDatabase.get(id))
5757

5858
override def batch(ids: NonEmptyList[UserId]): F[Map[UserId, User]] =
59-
latency[F](s"Batch Users $ids") >> CF.pure(userDatabase.filterKeys(ids.toList.toSet))
59+
latency[F](s"Batch Users $ids") >> CF.pure(
60+
userDatabase.view.filterKeys(ids.toList.toSet).toMap)
6061
}
6162
}
6263

@@ -89,7 +90,8 @@ object FetchTutorialHelper {
8990
latency[F](s"One Post $id") >> CF.pure(postDatabase.get(id))
9091

9192
override def batch(ids: NonEmptyList[PostId]): F[Map[PostId, Post]] =
92-
latency[F](s"Batch Posts $ids") >> CF.pure(postDatabase.filterKeys(ids.toList.toSet))
93+
latency[F](s"Batch Posts $ids") >> CF.pure(
94+
postDatabase.view.filterKeys(ids.toList.toSet).toMap)
9395
}
9496
}
9597

@@ -147,7 +149,8 @@ object FetchTutorialHelper {
147149
latency[F](s"One User $id") >> CF.pure(userDatabase.get(id))
148150

149151
override def batch(ids: NonEmptyList[UserId]): F[Map[UserId, User]] =
150-
latency[F](s"Batch Users $ids") >> CF.pure(userDatabase.filterKeys(ids.toList.toSet))
152+
latency[F](s"Batch Users $ids") >> CF.pure(
153+
userDatabase.view.filterKeys(ids.toList.toSet).toMap)
151154
}
152155
}
153156

@@ -169,7 +172,8 @@ object FetchTutorialHelper {
169172
latency[F](s"One User $id") >> CF.pure(userDatabase.get(id))
170173

171174
override def batch(ids: NonEmptyList[UserId]): F[Map[UserId, User]] =
172-
latency[F](s"Batch Users $ids") >> CF.pure(userDatabase.filterKeys(ids.toList.toSet))
175+
latency[F](s"Batch Users $ids") >> CF.pure(
176+
userDatabase.view.filterKeys(ids.toList.toSet).toMap)
173177
}
174178
}
175179

src/main/scala/fetchlib/UsageSection.scala

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,30 @@ import org.scalatest.matchers.should.Matchers
2727
*
2828
* If we are just reading data, we can make a series of optimizations such as:
2929
*
30-
* - batching requests to the same data source
31-
* - requesting independent data from different sources in parallel
32-
* - caching previously seen results
30+
* - batching requests to the same data source
31+
* - requesting independent data from different sources in parallel
32+
* - caching previously seen results
3333
*
3434
* However, if we mix these optimizations with the code that fetches the data
3535
* we may end up trading clarity for performance. Furthermore, we are
3636
* mixing low-level (optimization) and high-level (business logic with the data
3737
* we read) concerns.
38+
*
3839
* = Installation =
39-
*To begin, add the following dependency to your SBT build file:
40-
*{{{
41-
*"com.47deg" %% "fetch" % "1.2.1"
42-
*}}}
43-
*Or, if using Scala.js:
44-
*{{{
45-
*"com.47deg" %%% "fetch" % "1.2.1"
46-
*}}}
47-
*Now you’ll have Fetch available in both Scala and Scala.js.
40+
*
41+
* To begin, add the following dependency to your SBT build file:
42+
*
43+
* {{{
44+
* "com.47deg" %% "fetch" % "1.2.1"
45+
* }}}
46+
*
47+
* Or, if using Scala.js:
48+
*
49+
* {{{
50+
* "com.47deg" %%% "fetch" % "1.2.1"
51+
* }}}
52+
*
53+
* Now you’ll have Fetch available in both Scala and Scala.js.
4854
*
4955
* = Usage =
5056
*
@@ -68,8 +74,8 @@ import org.scalatest.matchers.should.Matchers
6874
*
6975
* It takes two type parameters:
7076
*
71-
* - `Identity`: the identity we want to fetch (a `UserId` if we were fetching users)
72-
* - `Result`: the type of the data we retrieve (a `User` if we were fetching users)
77+
* - `Identity`: the identity we want to fetch (a `UserId` if we were fetching users)
78+
* - `Result`: the type of the data we retrieve (a `User` if we were fetching users)
7379
*
7480
* There are two methods: `fetch` and `batch`. `fetch` receives one identity and must return
7581
* a `Concurrent` containing

version.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version in ThisBuild := "0.5.0-SNAPSHOT"
1+
version in ThisBuild := "0.6.0-SNAPSHOT"

0 commit comments

Comments
 (0)