Skip to content
Permalink
Browse files

Updated Scala version and dependencies

  • Loading branch information
kiroco12 committed Nov 19, 2019
1 parent 5b279cc commit c81d6294311f8dec94ea04fc998f7cf01c483f3b
Showing with 198 additions and 170 deletions.
  1. +7 −5 build.sbt
  2. +21 −14 project/ProjectPlugin.scala
  3. +1 −1 project/build.properties
  4. +2 −2 project/plugins.sbt
  5. +5 −5 src/main/scala/shapeless/ArityExercises.scala
  6. +4 −3 src/main/scala/shapeless/AutoTypeClassExercises.scala
  7. +4 −3 src/main/scala/shapeless/CoproductExercises.scala
  8. +3 −4 src/main/scala/shapeless/ExtensibleRecordsExercises.scala
  9. +4 −6 src/main/scala/shapeless/GenericExercises.scala
  10. +10 −10 src/main/scala/shapeless/HListExercises.scala
  11. +3 −3 src/main/scala/shapeless/HMapExercises.scala
  12. +7 −7 src/main/scala/shapeless/LazyExercises.scala
  13. +3 −2 src/main/scala/shapeless/LensesExercises.scala
  14. +4 −4 src/main/scala/shapeless/PolyExercises.scala
  15. +3 −2 src/main/scala/shapeless/ShapelessLib.scala
  16. +4 −3 src/main/scala/shapeless/SingletonExercises.scala
  17. +3 −2 src/main/scala/shapeless/SizedExercises.scala
  18. +3 −2 src/main/scala/shapeless/TuplesHListExercises.scala
  19. +3 −3 src/main/scala/shapeless/TypeCheckingExercises.scala
  20. +5 −4 src/main/scala/shapeless/TypeSafeCastExercises.scala
  21. +7 −6 src/test/scala/shapeless/AritySpec.scala
  22. +7 −6 src/test/scala/shapeless/AutoTypeClassSpec.scala
  23. +7 −6 src/test/scala/shapeless/CoproductSpec.scala
  24. +7 −6 src/test/scala/shapeless/ExtensibleRecordsSpec.scala
  25. +7 −6 src/test/scala/shapeless/GenericExercisesSpec.scala
  26. +7 −6 src/test/scala/shapeless/HListSpec.scala
  27. +7 −6 src/test/scala/shapeless/HMapExercisesSpec.scala
  28. +7 −6 src/test/scala/shapeless/LazyExercisesSpec.scala
  29. +7 −6 src/test/scala/shapeless/LensesExercisesSpec.scala
  30. +7 −6 src/test/scala/shapeless/PolySpec.scala
  31. +7 −6 src/test/scala/shapeless/SingletonExercisesSpec.scala
  32. +7 −6 src/test/scala/shapeless/SizedExercisesSpec.scala
  33. +7 −6 src/test/scala/shapeless/TuplesHListExercisesSpec.scala
  34. +7 −6 src/test/scala/shapeless/TypeCheckingExercisesSpec.scala
  35. +1 −1 version.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

@@ -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
)
)

@@ -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",
@@ -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))
)
}
@@ -1 +1 @@
sbt.version=0.13.13
sbt.version=1.2.8
@@ -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")
@@ -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._

@@ -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)
}

}
@@ -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._

@@ -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))
@@ -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
@@ -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

@@ -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 ==
*
@@ -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
@@ -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._

/** {{{
@@ -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)
@@ -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._

@@ -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 ==
*
@@ -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
@@ -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]] =
@@ -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
@@ -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
@@ -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)
@@ -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.
@@ -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
@@ -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
@@ -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,
* {{{
@@ -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
@@ -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
@@ -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

0 comments on commit c81d629

Please sign in to comment.
You can’t perform that action at this time.