Skip to content

Commit c81d629

Browse files
committed
Updated Scala version and dependencies
1 parent 5b279cc commit c81d629

35 files changed

+198
-170
lines changed

build.sbt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
val scalaExercisesV = "0.4.0-SNAPSHOT"
1+
import ProjectPlugin.autoImport._
2+
3+
val scalaExercisesV = "0.5.0-SNAPSHOT"
24

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

@@ -9,10 +11,10 @@ lazy val shapeless = (project in file("."))
911
libraryDependencies ++= Seq(
1012
dep("exercise-compiler"),
1113
dep("definitions"),
12-
%%("shapeless"),
13-
%%("scalatest"),
14-
%%("scalacheck"),
15-
%%("scheckShapeless")
14+
%%("shapeless", V.shapeless),
15+
%%("scalatest", V.scalatest),
16+
%%("scalacheck", V.scalacheck),
17+
"com.github.alexarchambault" %% "scalacheck-shapeless_1.14" % V.scalacheckShapeless
1618
)
1719
)
1820

project/ProjectPlugin.scala

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,30 @@
1-
import de.heikoseeberger.sbtheader.HeaderPattern
21
import de.heikoseeberger.sbtheader.HeaderPlugin.autoImport._
2+
import de.heikoseeberger.sbtheader.License._
33
import sbt.Keys._
44
import sbt._
5+
import sbtorgpolicies.OrgPoliciesPlugin.autoImport._
56
import sbtorgpolicies._
67
import sbtorgpolicies.model._
7-
import sbtorgpolicies.OrgPoliciesPlugin.autoImport._
88

99
object ProjectPlugin extends AutoPlugin {
1010

1111
override def trigger: PluginTrigger = allRequirements
1212

1313
override def requires: Plugins = plugins.JvmPlugin && OrgPoliciesPlugin
1414

15+
object autoImport {
16+
17+
lazy val V = new {
18+
val scala212: String = "2.12.10"
19+
val shapeless: String = "2.3.3"
20+
val scalatest: String = "3.0.8"
21+
val scalacheck: String = "1.14.2"
22+
val scalacheckShapeless: String = "1.2.3"
23+
}
24+
}
25+
26+
import autoImport._
27+
1528
override def projectSettings: Seq[Def.Setting[_]] =
1629
Seq(
1730
description := "Scala Exercises: The path to enlightenment",
@@ -25,23 +38,17 @@ object ProjectPlugin extends AutoPlugin {
2538
organizationEmail = "[email protected]"
2639
),
2740
orgLicenseSetting := ApacheLicense,
28-
scalaVersion := "2.11.11",
41+
scalaVersion := V.scala212,
2942
scalaOrganization := "org.scala-lang",
30-
crossScalaVersions := Seq("2.11.11"),
3143
resolvers ++= Seq(
3244
Resolver.mavenLocal,
3345
Resolver.sonatypeRepo("snapshots"),
3446
Resolver.sonatypeRepo("releases")
3547
),
36-
scalacOptions := sbtorgpolicies.model.scalacCommonOptions,
37-
headers := Map(
38-
"scala" -> (HeaderPattern.cStyleBlockComment,
39-
s"""|/*
40-
| * scala-exercises - ${name.value}
41-
| * Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
42-
| */
43-
|
44-
|""".stripMargin)
45-
)
48+
scalacOptions := sbtorgpolicies.model.scalacLanguageOptions,
49+
headerLicense := Some(Custom(s"""| scala-exercises - ${name.value}
50+
| Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
51+
|
52+
|""".stripMargin))
4653
)
4754
}

project/build.properties

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

project/plugins.sbt

Lines changed: 2 additions & 2 deletions
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.4.0-SNAPSHOT", "0.13", "2.10")
6-
addSbtPlugin("com.47deg" % "sbt-org-policies" % "0.5.13")
5+
addSbtPlugin("org.scala-exercises" % "sbt-exercise" % "0.5.0-SNAPSHOT")
6+
addSbtPlugin("com.47deg" % "sbt-org-policies" % "0.12.0-M3")

src/main/scala/shapeless/ArityExercises.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/*
2-
* scala-exercises - exercises-shapeless
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
2+
* scala-exercises - exercises-shapeless
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
4+
*
45
*/
56

67
package shapelessex
78

89
import org.scalatest._
910
import shapeless._
10-
import ops.hlist._
1111
import ops.function._
1212
import syntax.std.function._
1313

@@ -39,8 +39,8 @@ object ArityExercises extends FlatSpec with Matchers with org.scalaexercises.def
3939
/** Abstracting over arity
4040
*/
4141
def arityTest(res0: Int, res1: Int) = {
42-
applyProduct(1, 2)((_: Int) + (_: Int)) should be(res0)
43-
applyProduct(1, 2, 3)((_: Int) * (_: Int) * (_: Int)) should be(res1)
42+
applyProduct((1, 2))((_: Int) + (_: Int)) should be(res0)
43+
applyProduct((1, 2, 3))((_: Int) * (_: Int) * (_: Int)) should be(res1)
4444
}
4545

4646
}

src/main/scala/shapeless/AutoTypeClassExercises.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
/*
2-
* scala-exercises - exercises-shapeless
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
2+
* scala-exercises - exercises-shapeless
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
4+
*
45
*/
56

67
package shapelessex
78

9+
import scala.language.implicitConversions
810
import org.scalatest._
911
import shapeless._
1012

@@ -167,7 +169,6 @@ object AutoTypeClassExercises
167169
def monoidDerivation(res0: Int, res1: String, res2: Boolean, res3: String, res4: Double) = {
168170

169171
import MonoidSyntax._
170-
import Monoid.typeClass._
171172

172173
val fooCombined = Foo(13, "foo") |+| Foo(23, "bar")
173174
fooCombined should be(Foo(res0, res1))

src/main/scala/shapeless/CoproductExercises.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
2-
* scala-exercises - exercises-shapeless
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
2+
* scala-exercises - exercises-shapeless
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
4+
*
45
*/
56

67
package shapelessex
@@ -66,7 +67,7 @@ object CoproductExercises
6667
* adding labels to the elements of a Coproduct gives us a discriminated union.
6768
*/
6869
def unionE(res0: Option[Int], res1: Option[String], res2: Option[Boolean]) = {
69-
import record._, union._, syntax.singleton._
70+
import union._, syntax.singleton._
7071

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

src/main/scala/shapeless/ExtensibleRecordsExercises.scala

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
/*
2-
* scala-exercises - exercises-shapeless
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
2+
* scala-exercises - exercises-shapeless
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
4+
*
45
*/
56

67
package shapelessex
78

89
import org.scalatest._
9-
import shapeless._
10-
import ops.hlist._
1110

1211
/** == Extensible records ==
1312
*

src/main/scala/shapeless/GenericExercises.scala

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
2-
* scala-exercises - exercises-shapeless
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
2+
* scala-exercises - exercises-shapeless
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
4+
*
45
*/
56

67
package shapelessex
@@ -41,10 +42,7 @@ object GenericHelper {
4142
*
4243
* @param name generic
4344
*/
44-
object GenericExercises
45-
extends FlatSpec
46-
with Matchers
47-
with org.scalaexercises.definitions.Section {
45+
object GenericExercises extends FlatSpec with Matchers with org.scalaexercises.definitions.Section {
4846
import GenericHelper._
4947

5048
/** {{{

src/main/scala/shapeless/HListExercises.scala

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/*
2-
* scala-exercises - exercises-shapeless
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
2+
* scala-exercises - exercises-shapeless
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
4+
*
45
*/
56

67
package shapelessex
78

89
import org.scalatest._
910
import shapeless._
10-
import ops.hlist._
1111

1212
object size extends Poly1 {
1313
implicit def caseInt = at[Int](x 1)
@@ -143,13 +143,13 @@ object HListExercises extends FlatSpec with Matchers with org.scalaexercises.def
143143
apap.toList should be(res0)
144144

145145
/** And it has a `Typeable` type class instance (see below), allowing, eg. vanilla `List[Any]`'s or `HList`'s with
146-
* elements of type `Any` to be safely cast to precisely typed `HList`'s.
147-
* These last three features make this `HList` dramatically more practically useful than `HList`'s are typically thought to be:
148-
* normally the full type information required to work with them is too fragile to cross subtyping or I/O boundaries.
149-
* This implementation supports the discarding of precise information where necessary.
150-
* (eg. to serialize a precisely typed record after construction), and its later reconstruction.
151-
* (eg. a weakly typed deserialized record with a known schema can have its precise typing reestablished).
152-
*/
146+
* elements of type `Any` to be safely cast to precisely typed `HList`'s.
147+
* These last three features make this `HList` dramatically more practically useful than `HList`'s are typically thought to be:
148+
* normally the full type information required to work with them is too fragile to cross subtyping or I/O boundaries.
149+
* This implementation supports the discarding of precise information where necessary.
150+
* (eg. to serialize a precisely typed record after construction), and its later reconstruction.
151+
* (eg. a weakly typed deserialized record with a known schema can have its precise typing reestablished).
152+
*/
153153
def exerciseTypeable(res0: Option[APAP]) = {
154154
import syntax.typeable._
155155

src/main/scala/shapeless/HMapExercises.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/*
2-
* scala-exercises - exercises-shapeless
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
2+
* scala-exercises - exercises-shapeless
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
4+
*
45
*/
56

67
package shapelessex
78

89
import org.scalatest._
910
import shapeless._
10-
import ops.hlist._
1111

1212
/** == Heterogenous maps ==
1313
*

src/main/scala/shapeless/LazyExercises.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
2-
* scala-exercises - exercises-shapeless
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
2+
* scala-exercises - exercises-shapeless
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
4+
*
45
*/
56

67
package shapelessex
@@ -48,11 +49,10 @@ object LazyExercises extends FlatSpec with Matchers with org.scalaexercises.defi
4849
}
4950

5051
// Case for Cons[T]: note (mutually) recursive implicit argument referencing Show[List[T]]
51-
implicit def showCons[T](
52-
implicit st: Lazy[Show[T]],
53-
sl: Lazy[Show[List[T]]]): Show[Cons[T]] = new Show[Cons[T]] {
54-
def apply(t: Cons[T]) = s"Cons(${show(t.hd)(st.value)}, ${show(t.tl)(sl.value)})"
55-
}
52+
implicit def showCons[T](implicit st: Lazy[Show[T]], sl: Lazy[Show[List[T]]]): Show[Cons[T]] =
53+
new Show[Cons[T]] {
54+
def apply(t: Cons[T]) = s"Cons(${show(t.hd)(st.value)}, ${show(t.tl)(sl.value)})"
55+
}
5656

5757
// Case for List[T]: note (mutually) recursive implicit argument referencing Show[Cons[T]]
5858
implicit def showList[T](implicit sc: Lazy[Show[Cons[T]]]): Show[List[T]] =

src/main/scala/shapeless/LensesExercises.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
2-
* scala-exercises - exercises-shapeless
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
2+
* scala-exercises - exercises-shapeless
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
4+
*
45
*/
56

67
package shapelessex

src/main/scala/shapeless/PolyExercises.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
2-
* scala-exercises - exercises-shapeless
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
2+
* scala-exercises - exercises-shapeless
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
4+
*
45
*/
56

67
package shapelessex
@@ -30,7 +31,6 @@ object PolyExercises extends FlatSpec with Matchers with org.scalaexercises.defi
3031
* }}}
3132
*/
3233
def exerciseChoose(res0: Option[Int], res1: Option[Char]) = {
33-
import shapeless.poly._
3434
// choose is a function from Seqs to Options with no type specific cases
3535

3636
choose(Seq(1, 2, 3)) should be(res0)
@@ -43,7 +43,7 @@ object PolyExercises extends FlatSpec with Matchers with org.scalaexercises.defi
4343
def exercisePairApply(res0: Option[Int], res1: Option[Char]) = {
4444
def pairApply(f: Seq ~> Option) = (f(Seq(1, 2, 3)), f(Seq('a', 'b', 'c')))
4545

46-
pairApply(choose) should be(res0, res1)
46+
pairApply(choose) should be((res0, res1))
4747
}
4848

4949
/** They are nevertheless interoperable with ordinary monomorphic function values.

src/main/scala/shapeless/ShapelessLib.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
2-
* scala-exercises - exercises-shapeless
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
2+
* scala-exercises - exercises-shapeless
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
4+
*
45
*/
56

67
package shapelessex

src/main/scala/shapeless/SingletonExercises.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
2-
* scala-exercises - exercises-shapeless
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
2+
* scala-exercises - exercises-shapeless
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
4+
*
45
*/
56

67
package shapelessex
@@ -37,7 +38,7 @@ object SingletonExercises
3738
tuple(1) should be(res1)
3839
}
3940

40-
import shapeless._, syntax.singleton._
41+
import shapeless._
4142

4243
/** The examples in the shapeless tests and the following illustrate other possibilities,
4344
* {{{

src/main/scala/shapeless/SizedExercises.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
2-
* scala-exercises - exercises-shapeless
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
2+
* scala-exercises - exercises-shapeless
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
4+
*
45
*/
56

67
package shapelessex

src/main/scala/shapeless/TuplesHListExercises.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
2-
* scala-exercises - exercises-shapeless
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
2+
* scala-exercises - exercises-shapeless
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
4+
*
45
*/
56

67
package shapelessex

src/main/scala/shapeless/TypeCheckingExercises.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/*
2-
* scala-exercises - exercises-shapeless
3-
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
2+
* scala-exercises - exercises-shapeless
3+
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
4+
*
45
*/
56

67
package shapelessex
78

89
import org.scalatest._
9-
import shapeless._
1010

1111
import scala.util.Try
1212

0 commit comments

Comments
 (0)