Skip to content

Commit 377e61c

Browse files
authored
Merge pull request #55 from scala-exercises/enrique-2-13-1-update
Update to Scala 2.13.1
2 parents 2b7b939 + 57e03e7 commit 377e61c

18 files changed

+53
-52
lines changed

.scalafmt.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
version=2.3.2
12
style = defaultWithAlign
23
maxColumn = 100
34

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: scala
22
scala:
3-
- 2.11.11
3+
- 2.13.1
44
jdk:
55
- openjdk8
66
script:

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,11 +15,11 @@ 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 shapeless: String = "2.3.3"
2020
val scalatest: String = "3.1.0"
2121
val scalatestplusScheck: String = "3.1.0.0-RC2"
22-
val scalacheck: String = "1.14.2"
22+
val scalacheck: String = "1.14.3"
2323
val scalacheckShapeless: String = "1.2.3"
2424
}
2525
}
@@ -39,7 +39,7 @@ object ProjectPlugin extends AutoPlugin {
3939
organizationEmail = "hello@47deg.com"
4040
),
4141
orgLicenseSetting := ApacheLicense,
42-
scalaVersion := V.scala212,
42+
scalaVersion := V.scala213,
4343
scalaOrganization := "org.scala-lang",
4444
resolvers ++= Seq(
4545
Resolver.mavenLocal,

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.7

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/shapeless/ArityExercises.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ import ops.function._
1313
import syntax.std.function._
1414

1515
object Helper {
16-
def applyProduct[P <: Product, F, L <: HList, R](p: P)(
17-
f: F)(implicit gen: Generic.Aux[P, L], fp: FnToProduct.Aux[F, L R]) =
16+
def applyProduct[P <: Product, F, L <: HList, R](
17+
p: P
18+
)(f: F)(implicit gen: Generic.Aux[P, L], fp: FnToProduct.Aux[F, L => R]) =
1819
f.toProduct(gen.to(p))
1920
}
2021

src/main/scala/shapeless/AutoTypeClassExercises.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ object Monoid extends ProductTypeClassCompanion[Monoid] {
5050
def append(a: F :: T, b: F :: T) = mh.append(a.head, b.head) :: mt.append(a.tail, b.tail)
5151
}
5252

53-
def project[F, G](instance: Monoid[G], to: F G, from: G F) = new Monoid[F] {
53+
def project[F, G](instance: => Monoid[G], to: F => G, from: G => F) = new Monoid[F] {
5454
def zero = from(instance.zero)
5555
def append(a: F, b: F) = from(instance.append(to(a), to(b)))
5656
}

src/main/scala/shapeless/CoproductExercises.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ object CoproductExercises
2727
type ISB = Int :+: String :+: Boolean :+: CNil
2828

2929
object sizeM extends Poly1 {
30-
implicit def caseInt = at[Int](i (i, i))
31-
implicit def caseString = at[String](s (s, s.length))
32-
implicit def caseBoolean = at[Boolean](b (b, 1))
30+
implicit def caseInt = at[Int](i => (i, i))
31+
implicit def caseString = at[String](s => (s, s.length))
32+
implicit def caseBoolean = at[Boolean](b => (b, 1))
3333
}
3434

3535
val isb = Coproduct[ISB]("foo")
@@ -72,11 +72,11 @@ object CoproductExercises
7272

7373
type U = Union.`'i -> Int, 's -> String, 'b -> Boolean`.T
7474

75-
val u = Coproduct[U]('s ->> "foo") // Inject a String into the union at label 's
75+
val u = Coproduct[U](Symbol("s") ->> "foo") // Inject a String into the union at label 's
7676

77-
u.get('i) should be(res0)
78-
u.get('s) should be(res1)
79-
u.get('b) should be(res2)
77+
u.get(Symbol("i")) should be(res0)
78+
u.get(Symbol("s")) should be(res1)
79+
u.get(Symbol("b")) should be(res2)
8080
}
8181

8282
}

src/main/scala/shapeless/GenericExercises.scala

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ object GenericHelper {
2727
// Polymorphic function which adds 1 to any Int and is the identity
2828
// on all other values
2929
// format: OFF
30-
object inc extends -> ((i: Int) i + 1)
30+
object inc extends -> ((i: Int) => i + 1)
3131
// format: ON
3232
case class Book(author: String, title: String, id: Int, price: Double)
3333
case class ExtendedBook(author: String, title: String, id: Int, price: Double, inPrint: Boolean)
@@ -124,21 +124,19 @@ object GenericExercises
124124
val tapl = Book("Benjamin Pierce", "Types and Programming Languages", 262162091, 44.11)
125125
val rec = bookGen.to(tapl)
126126

127-
rec('price) should be(res0)
127+
rec(Symbol("price")) should be(res0)
128128

129-
val updatedBook = bookGen.from(rec.updateWith('price)(_ + 2.0))
129+
val updatedBook = bookGen.from(rec.updateWith(Symbol("price"))(_ + 2.0))
130130

131131
updatedBook.price should be(res1)
132132

133-
/** {{{
134-
* case class ExtendedBook(author: String, title: String, id: Int, price: Double, inPrint: Boolean)
135-
* }}}
136-
*/
133+
// case class ExtendedBook(author: String, title: String, id: Int, price: Double, inPrint: Boolean)
134+
137135
import syntax.singleton._
138136

139137
val bookExtGen = LabelledGeneric[ExtendedBook]
140138

141-
val extendedBook = bookExtGen.from(rec + ('inPrint ->> true))
139+
val extendedBook = bookExtGen.from(rec + (Symbol("inPrint") ->> true))
142140

143141
extendedBook.inPrint should be(res2)
144142
}

0 commit comments

Comments
 (0)