Skip to content

Commit

Permalink
0.21.6: Port to SBT v1 and mdoc
Browse files Browse the repository at this point in the history
This:
- Updates to SBT v1.2.8
- Uses coursier for SBT plugins
- Migrates away from tut and to mdoc
- Uses scala v2.11.12 and v2.12.8
- Updates monocle to v1.5.0
- Updates scalaz to v7.2.27
- Updates slamdata-predef to v0.0.7
- Updates sbt-slamdata to v2.4.1
- Drops support for openjdk7 in favor of openjdk8 since SBT v1 requires Scala 2.12 and thus JDK8

Question: do you still care about supporting 2.11?
  • Loading branch information
djspiewak committed May 22, 2019
2 parents 2233e28 + ec7ce4c commit 738daeb
Show file tree
Hide file tree
Showing 89 changed files with 342 additions and 289 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
project/project
!.gitignore
project/project/target
project/target
target
core/target
Expand All @@ -13,4 +14,4 @@ tmp
*.swp
tags
.ensime
.ensime_cache
.ensime_cache
12 changes: 4 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
language: scala
scala:
- 2.11.8
- 2.12.1
- 2.11.12
- 2.12.8
jdk:
- oraclejdk8
- openjdk7
matrix:
exclude: # NB: Scala 2.12 requires JDK 8
- scala: 2.12.1
jdk: openjdk7
- openjdk8

sudo: false
script:
- sbt checkHeaders
- sbt coverage doc test tut
- sbt coverage doc test mdoc
- sbt coverageReport
- sbt clean transferPublishAndTagResources
- scripts/publishAndTag 'slamdata/matryoshka'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Generalized folds, unfolds, and traversals for fixed point data structures in Sc

1. Add a dependency
```scala
libraryDependencies += "com.slamdata" %% "matryoshka-core" % "0.18.3"
libraryDependencies += "com.slamdata" %% "matryoshka-core" % "0.21.5"
```
Optionally, you can also depend on `matryoshka-scalacheck` to get `Arbitrary`/`Cogen`/`Shrink` instances for a bunch of pattern functors and fixed points.

Expand Down
71 changes: 43 additions & 28 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
import org.scalajs.sbtplugin.ScalaJSCrossVersion
import scoverage._
import sbt._
import Keys._
import slamdata.SbtSlamData.transferPublishAndTagResources
import sbt._, Keys._
import sbtcrossproject.CrossPlugin.autoImport.crossProject

lazy val monocleVersion = "1.4.0"
lazy val scalazVersion = "7.2.15"
lazy val scala2_12 = "2.12.8"
lazy val scala2_11 = "2.11.12"

lazy val monocleVersion = "1.5.0"
lazy val scalazVersion = "7.2.27"

lazy val supportedScalaVersions = List(scala2_12, scala2_11)

ThisBuild / scalaVersion := scala2_12

ThisBuild / crossScalaVersions := supportedScalaVersions

lazy val standardSettings = commonBuildSettings ++ Seq(
logBuffered in Compile := false,
logBuffered in Test := false,
Compile / logBuffered := false,
Test / logBuffered := false,
updateOptions := updateOptions.value.withCachedResolution(true),
exportJars := true,
organization := "com.slamdata",
ScoverageKeys.coverageHighlighting := true,
scalacOptions in (Compile, doc) ++= Seq("-groups", "-implicits"),
wartremoverWarnings in (Compile, compile) --= Seq(
Wart.PublicInference, // TODO: enable incrementally — currently results in many errors
Wart.ImplicitParameter), // see wartremover/wartremover#350 & #351

Compile / doc / scalacOptions ++= Seq("-groups", "-implicits"),
Compile / compile / wartremoverWarnings -= Wart.ImplicitParameter, // see wartremover/wartremover#350 & #351
libraryDependencies ++= Seq(
"com.slamdata" %% "slamdata-predef" % "0.0.6",
"com.slamdata" %% "slamdata-predef" % "0.0.7",
"com.github.julien-truffaut" %%% "monocle-core" % monocleVersion % "compile, test",
"org.scalaz" %%% "scalaz-core" % scalazVersion % "compile, test",
"com.github.mpilquist" %%% "simulacrum" % "0.11.0" % "compile, test"))
"com.github.mpilquist" %%% "simulacrum" % "0.15.0" % "compile, test"))

lazy val publishSettings = commonPublishSettings ++ Seq(
organizationName := "SlamData Inc.",
Expand All @@ -34,48 +38,59 @@ lazy val publishSettings = commonPublishSettings ++ Seq(
url("https://github.com/slamdata/matryoshka"),
"scm:[email protected]:slamdata/matryoshka.git")))

lazy val root = Project("root", file("."))
lazy val root = project.in(file("."))
.settings(name := "matryoshka")
.settings(standardSettings ++ noPublishSettings: _*)
.settings(transferPublishAndTagResources)
.settings(console := (console in replJVM).value)
.settings(
console := (console in replJVM).value,
crossScalaVersions := Nil,
releaseCrossBuild := false
)
.aggregate(
coreJS, scalacheckJS, testsJS,
coreJVM, scalacheckJVM, testsJVM,
docs)
.enablePlugins(AutomateHeaderPlugin)

lazy val core = crossProject.in(file("core"))
lazy val core = crossProject(JVMPlatform, JSPlatform).in(file("core"))
.settings(name := "matryoshka-core")
.settings(standardSettings ++ publishSettings: _*)
.enablePlugins(AutomateHeaderPlugin)

lazy val scalacheck = crossProject
lazy val scalacheck = crossProject(JVMPlatform, JSPlatform)
.dependsOn(core)
.settings(name := "matryoshka-scalacheck")
.settings(standardSettings ++ publishSettings: _*)
.settings(libraryDependencies ++= Seq(
// NB: Needs a version of Scalacheck with rickynils/scalacheck#301.
"org.scalacheck" %% "scalacheck" % "1.14.0-861f58e-SNAPSHOT",
"org.scalaz" %% "scalaz-scalacheck-binding" % (scalazVersion + "-scalacheck-1.13")))
"org.scalaz" %% "scalaz-scalacheck-binding" % (scalazVersion + "-scalacheck-1.14")))
.enablePlugins(AutomateHeaderPlugin)

lazy val tests = crossProject
lazy val tests = crossProject(JVMPlatform, JSPlatform)
.settings(name := "matryoshka-tests")
.dependsOn(core, scalacheck)
.settings(standardSettings ++ noPublishSettings: _*)
.settings(libraryDependencies ++= Seq(
"com.github.julien-truffaut" %% "monocle-law" % monocleVersion % Test,
"org.typelevel" %% "scalaz-specs2" % "0.5.0" % Test,
"org.specs2" %% "specs2-core" % "3.8.7" % Test))
"org.typelevel" %% "scalaz-specs2" % "0.5.2" % Test,
"org.specs2" %% "specs2-core" % "4.3.5" % Test))
.enablePlugins(AutomateHeaderPlugin)

lazy val docs = project
.settings(name := "matryoshka-docs")
.dependsOn(coreJVM)
.settings(standardSettings ++ noPublishSettings: _*)
.settings(tutScalacOptions --= Seq("-Yno-imports", "-Ywarn-unused-import"))
.enablePlugins(MicrositesPlugin)
.dependsOn(coreJVM)
.enablePlugins(MdocPlugin, MicrositesPlugin)
.settings(
//Compile / scalacOptions --= List("-Yno-imports", "-Ywarn-unused-import"),
Compile / scalacOptions -= "-Yno-imports",
Compile / scalacOptions -= "-Ywarn-unused-import",
mdocIn := file("docs/src/main/mdoc/"),
mdocVariables := Map(
"VERSION" -> version.value
)
)
.settings(
micrositeName := "Matryoshka",
micrositeDescription := "Generalized folds, unfolds, and traversals for fixed point data structures in Scala.",
Expand All @@ -89,7 +104,7 @@ lazy val docs = project
/** A project just for the console.
* Applies only the settings necessary for that purpose.
*/
lazy val repl = crossProject dependsOn (tests % "compile->test") settings standardSettings settings (
lazy val repl = crossProject(JVMPlatform, JSPlatform) dependsOn (tests % "compile->test") settings standardSettings settings (
console := (console in Test).value,
scalacOptions --= Seq("-Yno-imports", "-Ywarn-unused-import"),
initialCommands in console += """
Expand Down
7 changes: 6 additions & 1 deletion core/shared/src/main/scala/matryoshka/Based.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014–2017 SlamData Inc.
* Copyright 2014–2018 SlamData Inc.
*
* 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,6 +16,8 @@

package matryoshka

import slamdata.Predef._

import simulacrum.typeclass

/** Provides a type describing the pattern functor of some {co}recursive type
Expand All @@ -27,3 +29,6 @@ import simulacrum.typeclass
@typeclass trait Based[T] {
type Base[A]
}

@SuppressWarnings(Array("org.wartremover.warts.PublicInference"))
object Based
9 changes: 5 additions & 4 deletions core/shared/src/main/scala/matryoshka/Birecursive.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014–2017 SlamData Inc.
* Copyright 2014–2018 SlamData Inc.
*
* 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 @@ -191,10 +191,10 @@ object Birecursive {
def embed(ft: F[T])(implicit F: Functor[F]) = φ(ft)
}

def iso[T, F[_]: Functor](implicit T: Birecursive.Aux[T, F]) =
def iso[T, F[_]: Functor](implicit T: Birecursive.Aux[T, F]): AlgebraIso[F, T] =
AlgebraIso[F, T](T.embed(_))(T.project(_))

def lambekIso[T, F[_]: Functor](implicit T: Birecursive.Aux[T, F]) =
def lambekIso[T, F[_]: Functor](implicit T: Birecursive.Aux[T, F]): AlgebraIso[F, T] =
AlgebraIso[F, T](T.colambek(_))(T.lambek(_))

def equal[T, F[_]: Traverse]
Expand Down Expand Up @@ -257,7 +257,8 @@ object Birecursive {
: M[T] =
typeClassInstance.topDownCataM[M, A](self, a)(f)
object transPrepro {
def apply[U] = new PartiallyApplied[U]
def apply[U]: PartiallyApplied[U] = new PartiallyApplied[U]

final class PartiallyApplied[U] {
def apply[G[_]: Functor]
(e: F ~> F, f: Transform[U, F, G])
Expand Down
4 changes: 2 additions & 2 deletions core/shared/src/main/scala/matryoshka/BirecursiveT.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014–2017 SlamData Inc.
* Copyright 2014–2018 SlamData Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,5 +25,5 @@ package matryoshka
trait BirecursiveT[T[_[_]]] extends RecursiveT[T] with CorecursiveT[T]

object BirecursiveT {
def apply[T[_[_]]](implicit instance: BirecursiveT[T]) = instance
def apply[T[_[_]]](implicit instance: BirecursiveT[T]): BirecursiveT[T] = instance
}
2 changes: 1 addition & 1 deletion core/shared/src/main/scala/matryoshka/Corecursive.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014–2017 SlamData Inc.
* Copyright 2014–2018 SlamData Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions core/shared/src/main/scala/matryoshka/CorecursiveT.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014–2017 SlamData Inc.
* Copyright 2014–2018 SlamData Inc.
*
* 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 @@ -31,5 +31,5 @@ trait CorecursiveT[T[_[_]]] {
}

object CorecursiveT {
def apply[T[_[_]]](implicit instance: CorecursiveT[T]) = instance
def apply[T[_[_]]](implicit instance: CorecursiveT[T]): CorecursiveT[T] = instance
}
2 changes: 1 addition & 1 deletion core/shared/src/main/scala/matryoshka/Delay.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014–2017 SlamData Inc.
* Copyright 2014–2018 SlamData Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion core/shared/src/main/scala/matryoshka/Embed.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014–2017 SlamData Inc.
* Copyright 2014–2018 SlamData Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
3 changes: 2 additions & 1 deletion core/shared/src/main/scala/matryoshka/EqualT.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014–2017 SlamData Inc.
* Copyright 2014–2018 SlamData Inc.
*
* 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 @@ -30,6 +30,7 @@ import simulacrum._
Equal.equal[T[F]](equal[F](_, _)(Functor[F], delay))
}

@SuppressWarnings(Array("org.wartremover.warts.PublicInference"))
object EqualT {
def recursiveT[T[_[_]]: RecursiveT]: EqualT[T] = new EqualT[T] {
def equal[F[_]: Functor]
Expand Down
2 changes: 1 addition & 1 deletion core/shared/src/main/scala/matryoshka/Hole.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014–2017 SlamData Inc.
* Copyright 2014–2018 SlamData Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
3 changes: 2 additions & 1 deletion core/shared/src/main/scala/matryoshka/Merge.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014–2017 SlamData Inc.
* Copyright 2014–2018 SlamData Inc.
*
* 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 @@ -35,6 +35,7 @@ import scalaz._, Scalaz._
merge(fa, fb).map(_ g.tupled)
}

@SuppressWarnings(Array("org.wartremover.warts.PublicInference"))
object Merge {
implicit def fromTraverse[F[_]: Traverse](implicit E: Equal[F[Unit]]):
Merge[F] =
Expand Down
2 changes: 1 addition & 1 deletion core/shared/src/main/scala/matryoshka/Nested.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014–2017 SlamData Inc.
* Copyright 2014–2018 SlamData Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
15 changes: 9 additions & 6 deletions core/shared/src/main/scala/matryoshka/Recursive.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014–2017 SlamData Inc.
* Copyright 2014–2018 SlamData Inc.
*
* 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 @@ -171,7 +171,7 @@ trait Recursive[T] extends Based[T] { self =>
def gcataZygo[W[_]: Comonad, A, B]
(t: T)
(k: DistributiveLaw[Base, W], f: GAlgebra[W, Base, B], g: GAlgebra[(B, ?), Base, A])
(implicit BF: Functor[Base], BU: Unzip[Base]) =
(implicit BF: Functor[Base]): A =
gcata[(W[B], ?), A](
t)(
distZygo(fwa => k(fwa.map(_.cojoin)).map(f)),
Expand Down Expand Up @@ -445,7 +445,7 @@ object Recursive {
typeClassInstance.ghisto(self)(g, f)
def gcataZygo[W[_]: Comonad, A, B]
(w: DistributiveLaw[F, W], f: GAlgebra[W, F, B], g: GAlgebra[(B, ?), F, A])
(implicit BF: Functor[F], BU: Unzip[F])
(implicit BF: Functor[F])
: A =
typeClassInstance.gcataZygo[W, A, B](self)(w, f, g)
def paraZygo[A, B]
Expand Down Expand Up @@ -506,7 +506,8 @@ object Recursive {
typeClassInstance.convertTo[R](self)

object transCata {
def apply[U] = new PartiallyApplied[U]
def apply[U]: PartiallyApplied[U] = new PartiallyApplied[U]

final class PartiallyApplied[U] {
def apply[G[_]: Functor]
(f: F[U] => G[U])
Expand All @@ -517,7 +518,8 @@ object Recursive {
}

object transPostpro {
def apply[U] = new PartiallyApplied[U]
def apply[U]: PartiallyApplied[U] = new PartiallyApplied[U]

final class PartiallyApplied[U] {
def apply[G[_]: Functor]
(e: G ~> G, f: Transform[T, F, G])
Expand All @@ -528,7 +530,8 @@ object Recursive {
}

object transPara {
def apply[U] = new PartiallyApplied[U]
def apply[U]: PartiallyApplied[U] = new PartiallyApplied[U]

final class PartiallyApplied[U] {
def apply[G[_]: Functor]
(f: AlgebraicGTransform[(T, ?), U, F, G])
Expand Down
4 changes: 2 additions & 2 deletions core/shared/src/main/scala/matryoshka/RecursiveT.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014–2017 SlamData Inc.
* Copyright 2014–2018 SlamData Inc.
*
* 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 @@ -35,5 +35,5 @@ trait RecursiveT[T[_[_]]] extends Serializable {
}

object RecursiveT {
def apply[T[_[_]]](implicit instance: RecursiveT[T]) = instance
def apply[T[_[_]]](implicit instance: RecursiveT[T]): RecursiveT[T] = instance
}
Loading

0 comments on commit 738daeb

Please sign in to comment.