Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 29b4f4c
Showing
10 changed files
with
215 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
target/ | ||
.idea/ | ||
# vim | ||
*.sw? | ||
|
||
# Ignore [ce]tags files | ||
tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# tune this file as appropriate to your style! see: https://olafurpg.github.io/scalafmt/#Configuration | ||
|
||
maxColumn = 100 | ||
|
||
continuationIndent.callSite = 2 | ||
|
||
newlines { | ||
sometimesBeforeColonInMethodReturnType = false | ||
} | ||
|
||
align { | ||
arrowEnumeratorGenerator = false | ||
ifWhileOpenParen = false | ||
openParenCallSite = false | ||
openParenDefnSite = false | ||
|
||
tokens = ["%", "%%"] | ||
} | ||
|
||
docstrings = JavaDoc | ||
|
||
rewrite { | ||
rules = [SortImports, RedundantBraces] | ||
redundantBraces.maxLines = 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
sudo: false | ||
language: scala | ||
|
||
scala: | ||
- 2.12.6 | ||
- 2.11.12 | ||
|
||
before_cache: | ||
- find $HOME/.sbt -name "*.lock" -type f -delete | ||
- find $HOME/.ivy2/cache -name "ivydata-*.properties" -type f -delete | ||
|
||
cache: | ||
directories: | ||
- $HOME/.ivy2/cache | ||
- $HOME/.coursier/cache | ||
- $HOME/.sbt | ||
|
||
jdk: | ||
- oraclejdk8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# cats-scalacheck | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
lazy val core = project.in(file(".")) | ||
.settings(commonSettings) | ||
.settings( | ||
name := "cats-scalacheck" | ||
) | ||
|
||
val catsV = "1.1.0" | ||
val scalacheckV = "1.14.0" | ||
|
||
|
||
val specs2V = "4.2.0" | ||
val disciplineV = "0.8" | ||
|
||
|
||
lazy val contributors = Seq( | ||
"ChristopherDavenport" -> "Christopher Davenport" | ||
) | ||
|
||
lazy val commonSettings = Seq( | ||
organization := "io.chrisdavenport", | ||
|
||
scalaVersion := "2.12.6", | ||
crossScalaVersions := Seq(scalaVersion.value, "2.11.12"), | ||
|
||
addCompilerPlugin("org.spire-math" % "kind-projector" % "0.9.6" cross CrossVersion.binary), | ||
|
||
libraryDependencies ++= Seq( | ||
"org.typelevel" %% "cats-core" % catsV, | ||
"org.scalacheck" %% "scalacheck" % scalacheckV, | ||
|
||
"org.specs2" %% "specs2-core" % specs2V % Test, | ||
"org.specs2" %% "specs2-scalacheck" % specs2V % Test, | ||
"org.typelevel" %% "discipline" % disciplineV % Test | ||
) | ||
) | ||
|
||
lazy val releaseSettings = { | ||
import ReleaseTransformations._ | ||
Seq( | ||
releaseCrossBuild := true, | ||
releaseProcess := Seq[ReleaseStep]( | ||
checkSnapshotDependencies, | ||
inquireVersions, | ||
runClean, | ||
runTest, | ||
setReleaseVersion, | ||
commitReleaseVersion, | ||
tagRelease, | ||
// For non cross-build projects, use releaseStepCommand("publishSigned") | ||
releaseStepCommandAndRemaining("+publishSigned"), | ||
setNextVersion, | ||
commitNextVersion, | ||
releaseStepCommand("sonatypeReleaseAll"), | ||
pushChanges | ||
), | ||
publishTo := { | ||
val nexus = "https://oss.sonatype.org/" | ||
if (isSnapshot.value) | ||
Some("snapshots" at nexus + "content/repositories/snapshots") | ||
else | ||
Some("releases" at nexus + "service/local/staging/deploy/maven2") | ||
}, | ||
credentials ++= ( | ||
for { | ||
username <- Option(System.getenv().get("SONATYPE_USERNAME")) | ||
password <- Option(System.getenv().get("SONATYPE_PASSWORD")) | ||
} yield | ||
Credentials( | ||
"Sonatype Nexus Repository Manager", | ||
"oss.sonatype.org", | ||
username, | ||
password | ||
) | ||
).toSeq, | ||
publishArtifact in Test := false, | ||
releasePublishArtifactsAction := PgpKeys.publishSigned.value, | ||
scmInfo := Some( | ||
ScmInfo( | ||
url("https://github.com/ChristopherDavenport/cats-scalacheck"), | ||
"git@github.com:ChristopherDavenport/cats-scalacheck.git" | ||
) | ||
), | ||
homepage := Some(url("https://github.com/ChristopherDavenport/cats-scalacheck")), | ||
licenses += ("MIT", url("http://opensource.org/licenses/MIT")), | ||
publishMavenStyle := true, | ||
pomIncludeRepository := { _ => | ||
false | ||
}, | ||
pomExtra := { | ||
<developers> | ||
{for ((username, name) <- contributors) yield | ||
<developer> | ||
<id>{username}</id> | ||
<name>{name}</name> | ||
<url>http://github.com/{username}</url> | ||
</developer> | ||
} | ||
</developers> | ||
} | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sbt.version=1.1.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
addSbtPlugin("com.dwijnand" % "sbt-travisci" % "1.1.1") | ||
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.9.3") | ||
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.1") | ||
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.3") | ||
addSbtPlugin("org.lyranthe.sbt" % "partial-unification" % "1.1.0") | ||
addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.15") | ||
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.8") | ||
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.3") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package org.scalacheck.cats | ||
|
||
import org.scalacheck.cats.instances.GenInstances | ||
|
||
package object implicits extends GenInstances |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package org.scalacheck.cats.instances | ||
|
||
import cats._ | ||
import cats.implicits._ | ||
import org.scalacheck.Gen | ||
|
||
object GenInstances extends GenInstances | ||
|
||
trait GenInstances extends GenInstances1 | ||
|
||
sealed private[instances] trait GenInstances1 extends GenInstances0 { | ||
implicit val genInstances : Monad[Gen] with SemigroupK[Gen] = new Monad[Gen] with Alternative[Gen] { | ||
// Members declared in cats.Applicative | ||
override def pure[A](x: A): Gen[A] = Gen.const(x) | ||
|
||
// Members declared in cats.FlatMap | ||
override def flatMap[A, B](fa: Gen[A])(f: A => Gen[B]): Gen[B] = fa.flatMap(f) | ||
override def tailRecM[A, B](a: A)(f: A => Gen[Either[A,B]]): Gen[B] = Gen.tailRecM(a)(f) | ||
|
||
override def combineK[A](x: Gen[A], y: Gen[A]): Gen[A] = Gen.gen{ (params, seed) => | ||
val xGen = x.doApply(params, seed) | ||
if (xGen.retrieve.isDefined) xGen | ||
else y.doApply(params, seed) | ||
} | ||
|
||
override def empty[A]: Gen[A] = Gen.fail | ||
} | ||
|
||
implicit def genMonoid[A: Monoid]: Monoid[Gen[A]] = new Monoid[Gen[A]]{ | ||
override def empty: Gen[A] = Gen.const(Monoid[A].empty) | ||
override def combine(x: Gen[A], y: Gen[A]) = for { | ||
xa <- x | ||
ya <- y | ||
} yield xa |+| ya | ||
} | ||
|
||
} | ||
|
||
sealed private[instances] trait GenInstances0 { | ||
implicit def genSemigroup[A: Semigroup]: Semigroup[Gen[A]] = new Semigroup[Gen[A]]{ | ||
override def combine(x: Gen[A], y: Gen[A]) = for { | ||
xa <- x | ||
ya <- y | ||
} yield xa |+| ya | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
version in ThisBuild := "0.0.1-SNAPSHOT" |