Skip to content

Commit

Permalink
Version upgrades (fixes #68)
Browse files Browse the repository at this point in the history
sbt 1.1.0
coursier 1.0.0
kind-projector 0.9.5
Scala 2.12.4-bin-typelevel-4
Cats 1.0.1
circe 0.9.1
shapeless 2.3.3
scodec-cats 0.6.0
FS2 0.10.0-RC2
refined 0.8.6
scalatest 3.0.3
... and others
  • Loading branch information
durban committed Jan 27, 2018
1 parent 76fe789 commit 33ee02a
Show file tree
Hide file tree
Showing 18 changed files with 78 additions and 71 deletions.
38 changes: 20 additions & 18 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2017 Daniel Urban and contributors listed in AUTHORS
* Copyright 2016-2018 Daniel Urban and contributors listed in AUTHORS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -93,10 +93,10 @@ lazy val consts = new {
}

lazy val commonSettings: Seq[Setting[_]] = Seq[Setting[_]](
scalaVersion := "2.12.3-bin-typelevel-4",
scalaVersion := "2.12.4-bin-typelevel-4",
crossScalaVersions := Seq(scalaVersion.value, "2.11.11-bin-typelevel-4"),
scalaOrganization := "org.typelevel",
crossSbtVersions := Vector("0.13.16", "1.0.3"), // for some reason this has to be here for ^ to work
crossSbtVersions := Vector("0.13.16", "1.1.0"), // for some reason this has to be here for ^ to work
scalacOptions ++= Seq(
"-feature",
"-deprecation",
Expand All @@ -122,7 +122,8 @@ lazy val commonSettings: Seq[Setting[_]] = Seq[Setting[_]](
"-Ywarn-unused:imports",
"-Ywarn-unused:locals",
"-Ywarn-unused:patvars",
"-Ywarn-unused:privates"
"-Ywarn-unused:privates",
"-Ywarn-macros:after"
)
case Some((2, 11)) =>
Seq(
Expand All @@ -136,7 +137,7 @@ lazy val commonSettings: Seq[Setting[_]] = Seq[Setting[_]](
},
scalacOptions in (Compile, console) ~= { _.filterNot("-Ywarn-unused-import" == _).filterNot("-Ywarn-unused:imports" == _) },
scalacOptions in (Test, console) := (scalacOptions in (Compile, console)).value,
addCompilerPlugin("org.spire-math" % "kind-projector" % "0.9.3" cross CrossVersion.binary),
addCompilerPlugin("org.spire-math" % "kind-projector" % "0.9.5" cross CrossVersion.binary),

// We need both of these, due to https://github.com/scalastyle/scalastyle-sbt-plugin/issues/44
scalastyleConfig in Test := (baseDirectory in ThisBuild).value / "scalastyle-test-config.xml",
Expand Down Expand Up @@ -241,7 +242,7 @@ lazy val pluginSettings = Seq[Setting[_]](
scalaVersion := {
(sbtBinaryVersion in pluginCrossBuild).value match {
case "0.13" => "2.10.6"
case "1.0" => "2.12.3-bin-typelevel-4"
case "1.0" => "2.12.4-bin-typelevel-4"
case x => sys.error(s"Unknown sbtBinaryVersion: ${x}")
}
},
Expand All @@ -250,6 +251,7 @@ lazy val pluginSettings = Seq[Setting[_]](
(sbtBinaryVersion in pluginCrossBuild).value match {
case "0.13" => "org.scala-lang"
case "1.0" => "org.typelevel"
case "1.1" => "org.typelevel"
case x => sys.error(s"Unknown sbtBinaryVersion: ${x}")
}
},
Expand Down Expand Up @@ -289,10 +291,10 @@ lazy val refinedSettings = Seq[Setting[_]](

lazy val dependencies = new {

val catsVersion = "1.0.0-RC1"
val circeVersion = "0.9.0-M2"
val catsVersion = "1.0.1"
val circeVersion = "0.9.1"

val shapeless = "com.chuusai" %% "shapeless" % "2.3.2"
val shapeless = "com.chuusai" %% "shapeless" % "2.3.3"
val cats = "org.typelevel" %% "cats-core" % catsVersion

val circe = Seq(
Expand All @@ -302,15 +304,15 @@ lazy val dependencies = new {
)

val scodecBits = "org.scodec" %% "scodec-bits" % "1.1.4"
val scodecCats = "org.scodec" %% "scodec-cats" % "0.5.0"
val scodecCats = "org.scodec" %% "scodec-cats" % "0.6.0"
val scodec = Seq(
scodecBits,
"org.scodec" %% "scodec-core" % "1.10.3",
"org.scodec" %% "scodec-stream" % "1.1.0-M8",
"org.scodec" %% "scodec-stream" % "1.1.0-RC2",
scodecCats
)

val refined = "eu.timepit" %% "refined" % "0.8.4"
val refined = "eu.timepit" %% "refined" % "0.8.6"

val laws = Seq(
scodecCats,
Expand All @@ -319,7 +321,7 @@ lazy val dependencies = new {
)

val test = Seq(
"org.scalatest" %% "scalatest" % "3.0.2"
"org.scalatest" %% "scalatest" % "3.0.3"
)

val sbtMima = "com.typesafe" % "sbt-mima-plugin" % "0.1.14"
Expand Down Expand Up @@ -422,8 +424,8 @@ lazy val exampleSettings = Seq(

lazy val exampleDependencies = new {

val http4sVersion = "0.18.0-M5"
val fs2Version = "0.10.0-M8"
val http4sVersion = "0.18.0-M9"
val fs2Version = "0.10.0-RC2"

val http4s = Seq(
"org.http4s" %% "http4s-dsl" % http4sVersion,
Expand All @@ -440,11 +442,11 @@ lazy val exampleDependencies = new {
"co.fs2" %% "fs2-io" % fs2Version
)

val catsEffect = "org.typelevel" %% "cats-effect" % "0.5"
val catsEffect = "org.typelevel" %% "cats-effect" % "0.8"

val akka = Seq(
"com.typesafe.akka" %% "akka-stream" % "2.5.6",
"com.typesafe.akka" %% "akka-stream" % "2.5.9",
"org.scodec" %% "scodec-akka" % "0.3.0",
"com.github.zainab-ali" %% "fs2-reactive-streams" % "0.2.5"
"com.github.zainab-ali" %% "fs2-reactive-streams" % "0.3.0"
)
}
11 changes: 7 additions & 4 deletions core/src/main/scala/io/sigs/seals/core/reified.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2017 Daniel Urban and contributors listed in AUTHORS
* Copyright 2016-2018 Daniel Urban and contributors listed in AUTHORS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -282,13 +282,16 @@ object Reified extends LowPrioReified1 {
type Fst = Witness.`'_1`.T
type Snd = Witness.`'_2`.T

def pure[A](a: A): Reified[A] =
override def unit: Reified[Unit] =
point(())

override def point[A](a: A): Reified[A] =
Reified[HNil].imap(_ => a)(_ => HNil)

def imap[A, B](fa: Reified[A])(f: A => B)(g: B => A): Reified[B] =
override def imap[A, B](fa: Reified[A])(f: A => B)(g: B => A): Reified[B] =
fa.imap(f)(g)

def product[A, B](fa: Reified[A], fb: Reified[B]): Reified[(A, B)] = {
override def product[A, B](fa: Reified[A], fb: Reified[B]): Reified[(A, B)] = {
implicit val ra: Reified[A] = fa
implicit val rb: Reified[B] = fb
Reified[FieldType[Fst, A] :: FieldType[Snd, B] :: HNil].imap[(A, B)] { hl =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 Daniel Urban and contributors listed in AUTHORS
* Copyright 2016-2018 Daniel Urban and contributors listed in AUTHORS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -51,7 +51,8 @@ class ClientSpec extends FlatSpec with Matchers with BeforeAndAfterAll {
Stream(Server.serve(1237).drain, Stream.eval(sem.decrement))
.join(Int.MaxValue)
.take(1)
.runLog
.compile
.drain
.unsafeRunAsync(_ => ())
try {
val resp = Await.result(Client.client(1237), 2.seconds)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2017 Daniel Urban and contributors listed in AUTHORS
* Copyright 2016-2018 Daniel Urban and contributors listed in AUTHORS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -59,7 +59,7 @@ class IncompatibleClientSpec
incompatibleClient(localAddr.getPort)
case Right(_) =>
Stream.empty
}.take(1L).runLog.attempt.unsafeRunSync()
}.take(1L).compile.toVector.attempt.unsafeRunSync()

inside(resp) {
case Left(ex) => ex.getMessage should include ("incompatible models")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2017 Daniel Urban and contributors listed in AUTHORS
* Copyright 2016-2018 Daniel Urban and contributors listed in AUTHORS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -55,7 +55,7 @@ object Server {
val ex = Executors.newCachedThreadPool()
val cg = ACG.withThreadPool(ex)
try {
serve(1234)(cg, ExecutionContext.global).run.unsafeRunSync()
serve(1234)(cg, ExecutionContext.global).compile.drain.unsafeRunSync()
} finally {
cg.shutdown()
ex.shutdown()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 Daniel Urban and contributors listed in AUTHORS
* Copyright 2016-2018 Daniel Urban and contributors listed in AUTHORS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -63,7 +63,7 @@ class ServerSpec extends FlatSpec with Matchers with BeforeAndAfterAll {
}
val responses: Vector[Response] = str
.join(Int.MaxValue)
.take((nClients * testData.size).toLong).runLog.unsafeRunSync()
.take((nClients * testData.size).toLong).compile.toVector.unsafeRunSync()

val randInts = responses.collect { case RandInt(i) => i }
val seededs = responses.collect { case Seeded => () }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2017 Daniel Urban and contributors listed in AUTHORS
* Copyright 2016-2018 Daniel Urban and contributors listed in AUTHORS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,13 +16,14 @@

package com.example.messaging

import scala.concurrent.ExecutionContext.Implicits.global

import cats.effect.IO

import fs2.Stream
import fs2.{ Stream, StreamApp }

import org.http4s._
import org.http4s.dsl.io._
import org.http4s.util.{ StreamApp, ExitCode }
import org.http4s.circe._

import io.sigs.seals._
Expand All @@ -39,7 +40,7 @@ object MyClient extends App {
import org.http4s.client.blaze._
import Protocol._

val client = PooledHttp1Client[IO]()
val client = Http1Client[IO]().unsafeRunSync()

val pongGood = jsonEncoderOf[IO, Envelope[Ping]].toEntity(
Envelope(Ping(42L, Vector(1, 2, 3, 4)))
Expand Down Expand Up @@ -81,7 +82,7 @@ object MyServer extends StreamApp[IO] {
} yield resp
}

override def stream(args: List[String], requestShutdown: IO[Unit]): Stream[IO, ExitCode] = {
override def stream(args: List[String], requestShutdown: IO[Unit]): Stream[IO, StreamApp.ExitCode] = {
BlazeBuilder[IO]
.bindHttp(1234, "localhost")
.mountService(service, "/")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 Daniel Urban and contributors listed in AUTHORS
* Copyright 2016-2018 Daniel Urban and contributors listed in AUTHORS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -42,7 +42,7 @@ object Main {
val sOut: Stream[IO, Unit] = StreamCodec[Animal].encode(sIn).flatMap { bv =>
Stream.chunk(Chunk.bytes(bv.bytes.toArray))
}.to(fs2.io.writeOutputStream(IO.pure(to)))
sOut.run
sOut.compile.drain
}

val transformer: Animal => Stream[Pure, Animal] = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 Daniel Urban and contributors listed in AUTHORS
* Copyright 2016-2018 Daniel Urban and contributors listed in AUTHORS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -56,8 +56,8 @@ class StreamingSpec extends FlatSpec with Matchers {

"Encoding/decoding" should "work correctly" in {
val tsk: IO[Unit] = for {
bv <- codec.encode[IO](animalStream).runFold(BitVector.empty)(_ ++ _)
as <- codec.decode[IO](bv).runLog
bv <- codec.encode[IO](animalStream).compile.fold(BitVector.empty)(_ ++ _)
as <- codec.decode[IO](bv).compile.toVector
} yield {
as should === (animals)
}
Expand All @@ -68,7 +68,7 @@ class StreamingSpec extends FlatSpec with Matchers {
val mod = Reified[Record.`'Elephant -> Elephant, 'Quokka -> Quokka`.T].model
val bv: BitVector = Codec[Model].encode(mod).getOrElse(fail)
val tsk: IO[Unit] = for {
as <- codec.decode[IO](bv).runLog
as <- codec.decode[IO](bv).compile.toVector
} yield {
as should === (Vector.empty)
}
Expand All @@ -81,12 +81,12 @@ class StreamingSpec extends FlatSpec with Matchers {

"Transformation" should "work correctly" in {
val tsk: IO[Unit] = for {
ibv <- codec.encode[IO](animalStream).runFold(BitVector.empty)(_ ++ _)
ibv <- codec.encode[IO](animalStream).compile.fold(BitVector.empty)(_ ++ _)
is = new ByteArrayInputStream(ibv.toByteArray)
os = new ByteArrayOutputStream
_ <- Main.transform(is, os)(Main.transformer)
obv = BitVector(os.toByteArray())
transformed <- codec.decode[IO](obv).runFold(Vector.empty[Animal])(_ :+ _)
transformed <- codec.decode[IO](obv).compile.fold(Vector.empty[Animal])(_ :+ _)
} yield {
transformed should === (transformedAnimals)
}
Expand Down
6 changes: 3 additions & 3 deletions plugin/src/sbt-test/seals-plugin/example/build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 Daniel Urban and contributors listed in AUTHORS
* Copyright 2017-2018 Daniel Urban and contributors listed in AUTHORS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,7 +29,7 @@ lazy val server = project
.dependsOn(proto)
.settings(libraryDependencies ++= Seq(
"io.sigs" %% "seals-scodec" % sealsVersion,
"co.fs2" %% "fs2-io" % "0.10.0-M8"
"co.fs2" %% "fs2-io" % "0.10.0-RC2"
))

lazy val example = project.in(file("."))
Expand All @@ -43,7 +43,7 @@ lazy val commonSettings = Seq[Setting[_]](
scalaVersion := "2.11.11",
libraryDependencies ++= Seq(
"io.sigs" %% "seals-core" % sealsVersion,
"org.scalatest" %% "scalatest" % "3.0.2" % Test
"org.scalatest" %% "scalatest" % "3.0.3" % Test
)
)

Expand Down
6 changes: 3 additions & 3 deletions plugin/src/sbt-test/seals-plugin/example/changes/v010.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 Daniel Urban and contributors listed in AUTHORS
* Copyright 2017-2018 Daniel Urban and contributors listed in AUTHORS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,7 +29,7 @@ lazy val server = project
.dependsOn(proto)
.settings(libraryDependencies ++= Seq(
"io.sigs" %% "seals-scodec" % sealsVersion,
"co.fs2" %% "fs2-io" % "0.10.0-M8"
"co.fs2" %% "fs2-io" % "0.10.0-RC2"
))

lazy val example = project.in(file("."))
Expand All @@ -43,7 +43,7 @@ lazy val commonSettings = Seq[Setting[_]](
scalaVersion := "2.11.11",
libraryDependencies ++= Seq(
"io.sigs" %% "seals-core" % sealsVersion,
"org.scalatest" %% "scalatest" % "3.0.2" % Test
"org.scalatest" %% "scalatest" % "3.0.3" % Test
)
)

Expand Down
6 changes: 3 additions & 3 deletions plugin/src/sbt-test/seals-plugin/example/changes/v020.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 Daniel Urban and contributors listed in AUTHORS
* Copyright 2017-2018 Daniel Urban and contributors listed in AUTHORS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,7 +29,7 @@ lazy val server = project
.dependsOn(proto)
.settings(libraryDependencies ++= Seq(
"io.sigs" %% "seals-scodec" % sealsVersion,
"co.fs2" %% "fs2-io" % "0.10.0-M8"
"co.fs2" %% "fs2-io" % "0.10.0-RC2"
))

lazy val example = project.in(file("."))
Expand All @@ -43,7 +43,7 @@ lazy val commonSettings = Seq[Setting[_]](
scalaVersion := "2.11.11",
libraryDependencies ++= Seq(
"io.sigs" %% "seals-core" % sealsVersion,
"org.scalatest" %% "scalatest" % "3.0.2" % Test
"org.scalatest" %% "scalatest" % "3.0.3" % Test
)
)

Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.0.4
sbt.version=1.1.0
Loading

0 comments on commit 33ee02a

Please sign in to comment.