Skip to content

Commit

Permalink
Updated Scala version and dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
kiroco12 committed Nov 19, 2019
1 parent 5b279cc commit c81d629
Show file tree
Hide file tree
Showing 35 changed files with 198 additions and 170 deletions.
12 changes: 7 additions & 5 deletions build.sbt
@@ -1,4 +1,6 @@
val scalaExercisesV = "0.4.0-SNAPSHOT"
import ProjectPlugin.autoImport._

val scalaExercisesV = "0.5.0-SNAPSHOT"

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

Expand All @@ -9,10 +11,10 @@ lazy val shapeless = (project in file("."))
libraryDependencies ++= Seq(
dep("exercise-compiler"),
dep("definitions"),
%%("shapeless"),
%%("scalatest"),
%%("scalacheck"),
%%("scheckShapeless")
%%("shapeless", V.shapeless),
%%("scalatest", V.scalatest),
%%("scalacheck", V.scalacheck),
"com.github.alexarchambault" %% "scalacheck-shapeless_1.14" % V.scalacheckShapeless
)
)

Expand Down
35 changes: 21 additions & 14 deletions project/ProjectPlugin.scala
@@ -1,17 +1,30 @@
import de.heikoseeberger.sbtheader.HeaderPattern
import de.heikoseeberger.sbtheader.HeaderPlugin.autoImport._
import de.heikoseeberger.sbtheader.License._
import sbt.Keys._
import sbt._
import sbtorgpolicies.OrgPoliciesPlugin.autoImport._
import sbtorgpolicies._
import sbtorgpolicies.model._
import sbtorgpolicies.OrgPoliciesPlugin.autoImport._

object ProjectPlugin extends AutoPlugin {

override def trigger: PluginTrigger = allRequirements

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

object autoImport {

lazy val V = new {
val scala212: String = "2.12.10"
val shapeless: String = "2.3.3"
val scalatest: String = "3.0.8"
val scalacheck: String = "1.14.2"
val scalacheckShapeless: String = "1.2.3"
}
}

import autoImport._

override def projectSettings: Seq[Def.Setting[_]] =
Seq(
description := "Scala Exercises: The path to enlightenment",
Expand All @@ -25,23 +38,17 @@ object ProjectPlugin extends AutoPlugin {
organizationEmail = "hello@47deg.com"
),
orgLicenseSetting := ApacheLicense,
scalaVersion := "2.11.11",
scalaVersion := V.scala212,
scalaOrganization := "org.scala-lang",
crossScalaVersions := Seq("2.11.11"),
resolvers ++= Seq(
Resolver.mavenLocal,
Resolver.sonatypeRepo("snapshots"),
Resolver.sonatypeRepo("releases")
),
scalacOptions := sbtorgpolicies.model.scalacCommonOptions,
headers := Map(
"scala" -> (HeaderPattern.cStyleBlockComment,
s"""|/*
| * scala-exercises - ${name.value}
| * Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
| */
|
|""".stripMargin)
)
scalacOptions := sbtorgpolicies.model.scalacLanguageOptions,
headerLicense := Some(Custom(s"""| scala-exercises - ${name.value}
| Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
|
|""".stripMargin))
)
}
2 changes: 1 addition & 1 deletion project/build.properties
@@ -1 +1 @@
sbt.version=0.13.13
sbt.version=1.2.8
4 changes: 2 additions & 2 deletions project/plugins.sbt
Expand Up @@ -2,5 +2,5 @@ resolvers ++= Seq(
Resolver.sonatypeRepo("snapshots")
)

addSbtPlugin("org.scala-exercises" % "sbt-exercise" % "0.4.0-SNAPSHOT", "0.13", "2.10")
addSbtPlugin("com.47deg" % "sbt-org-policies" % "0.5.13")
addSbtPlugin("org.scala-exercises" % "sbt-exercise" % "0.5.0-SNAPSHOT")
addSbtPlugin("com.47deg" % "sbt-org-policies" % "0.12.0-M3")
10 changes: 5 additions & 5 deletions src/main/scala/shapeless/ArityExercises.scala
@@ -1,13 +1,13 @@
/*
* scala-exercises - exercises-shapeless
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-shapeless
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package shapelessex

import org.scalatest._
import shapeless._
import ops.hlist._
import ops.function._
import syntax.std.function._

Expand Down Expand Up @@ -39,8 +39,8 @@ object ArityExercises extends FlatSpec with Matchers with org.scalaexercises.def
/** Abstracting over arity
*/
def arityTest(res0: Int, res1: Int) = {
applyProduct(1, 2)((_: Int) + (_: Int)) should be(res0)
applyProduct(1, 2, 3)((_: Int) * (_: Int) * (_: Int)) should be(res1)
applyProduct((1, 2))((_: Int) + (_: Int)) should be(res0)
applyProduct((1, 2, 3))((_: Int) * (_: Int) * (_: Int)) should be(res1)
}

}
7 changes: 4 additions & 3 deletions src/main/scala/shapeless/AutoTypeClassExercises.scala
@@ -1,10 +1,12 @@
/*
* scala-exercises - exercises-shapeless
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-shapeless
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package shapelessex

import scala.language.implicitConversions
import org.scalatest._
import shapeless._

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

import MonoidSyntax._
import Monoid.typeClass._

val fooCombined = Foo(13, "foo") |+| Foo(23, "bar")
fooCombined should be(Foo(res0, res1))
Expand Down
7 changes: 4 additions & 3 deletions src/main/scala/shapeless/CoproductExercises.scala
@@ -1,6 +1,7 @@
/*
* scala-exercises - exercises-shapeless
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-shapeless
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

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

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

Expand Down
7 changes: 3 additions & 4 deletions src/main/scala/shapeless/ExtensibleRecordsExercises.scala
@@ -1,13 +1,12 @@
/*
* scala-exercises - exercises-shapeless
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-shapeless
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package shapelessex

import org.scalatest._
import shapeless._
import ops.hlist._

/** == Extensible records ==
*
Expand Down
10 changes: 4 additions & 6 deletions src/main/scala/shapeless/GenericExercises.scala
@@ -1,6 +1,7 @@
/*
* scala-exercises - exercises-shapeless
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-shapeless
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package shapelessex
Expand Down Expand Up @@ -41,10 +42,7 @@ object GenericHelper {
*
* @param name generic
*/
object GenericExercises
extends FlatSpec
with Matchers
with org.scalaexercises.definitions.Section {
object GenericExercises extends FlatSpec with Matchers with org.scalaexercises.definitions.Section {
import GenericHelper._

/** {{{
Expand Down
20 changes: 10 additions & 10 deletions src/main/scala/shapeless/HListExercises.scala
@@ -1,13 +1,13 @@
/*
* scala-exercises - exercises-shapeless
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-shapeless
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package shapelessex

import org.scalatest._
import shapeless._
import ops.hlist._

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

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

Expand Down
6 changes: 3 additions & 3 deletions src/main/scala/shapeless/HMapExercises.scala
@@ -1,13 +1,13 @@
/*
* scala-exercises - exercises-shapeless
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-shapeless
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package shapelessex

import org.scalatest._
import shapeless._
import ops.hlist._

/** == Heterogenous maps ==
*
Expand Down
14 changes: 7 additions & 7 deletions src/main/scala/shapeless/LazyExercises.scala
@@ -1,6 +1,7 @@
/*
* scala-exercises - exercises-shapeless
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-shapeless
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package shapelessex
Expand Down Expand Up @@ -48,11 +49,10 @@ object LazyExercises extends FlatSpec with Matchers with org.scalaexercises.defi
}

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

// Case for List[T]: note (mutually) recursive implicit argument referencing Show[Cons[T]]
implicit def showList[T](implicit sc: Lazy[Show[Cons[T]]]): Show[List[T]] =
Expand Down
5 changes: 3 additions & 2 deletions src/main/scala/shapeless/LensesExercises.scala
@@ -1,6 +1,7 @@
/*
* scala-exercises - exercises-shapeless
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-shapeless
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package shapelessex
Expand Down
8 changes: 4 additions & 4 deletions src/main/scala/shapeless/PolyExercises.scala
@@ -1,6 +1,7 @@
/*
* scala-exercises - exercises-shapeless
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-shapeless
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

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

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

pairApply(choose) should be(res0, res1)
pairApply(choose) should be((res0, res1))
}

/** They are nevertheless interoperable with ordinary monomorphic function values.
Expand Down
5 changes: 3 additions & 2 deletions src/main/scala/shapeless/ShapelessLib.scala
@@ -1,6 +1,7 @@
/*
* scala-exercises - exercises-shapeless
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-shapeless
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package shapelessex
Expand Down
7 changes: 4 additions & 3 deletions src/main/scala/shapeless/SingletonExercises.scala
@@ -1,6 +1,7 @@
/*
* scala-exercises - exercises-shapeless
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-shapeless
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package shapelessex
Expand Down Expand Up @@ -37,7 +38,7 @@ object SingletonExercises
tuple(1) should be(res1)
}

import shapeless._, syntax.singleton._
import shapeless._

/** The examples in the shapeless tests and the following illustrate other possibilities,
* {{{
Expand Down
5 changes: 3 additions & 2 deletions src/main/scala/shapeless/SizedExercises.scala
@@ -1,6 +1,7 @@
/*
* scala-exercises - exercises-shapeless
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-shapeless
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package shapelessex
Expand Down
5 changes: 3 additions & 2 deletions src/main/scala/shapeless/TuplesHListExercises.scala
@@ -1,6 +1,7 @@
/*
* scala-exercises - exercises-shapeless
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-shapeless
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package shapelessex
Expand Down
6 changes: 3 additions & 3 deletions src/main/scala/shapeless/TypeCheckingExercises.scala
@@ -1,12 +1,12 @@
/*
* scala-exercises - exercises-shapeless
* Copyright (C) 2015-2016 47 Degrees, LLC. <http://www.47deg.com>
* scala-exercises - exercises-shapeless
* Copyright (C) 2015-2019 47 Degrees, LLC. <http://www.47deg.com>
*
*/

package shapelessex

import org.scalatest._
import shapeless._

import scala.util.Try

Expand Down

0 comments on commit c81d629

Please sign in to comment.