-
Notifications
You must be signed in to change notification settings - Fork 66
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
Showing
72 changed files
with
985 additions
and
846 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 |
---|---|---|
@@ -1 +1 @@ | ||
alias boot = ;reload ;project root ;iflast shell | ||
alias boot = ;reload ;project kittens ;iflast shell |
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,11 @@ | ||
version = "2.7.5" | ||
align.preset = none | ||
maxColumn = 120 | ||
includeNoParensInSelectChains = false | ||
includeCurlyBraceInSelectChains = false | ||
trailingCommas = "never" | ||
rewrite.rules = [RedundantBraces, AvoidInfix, SortModifiers, PreferCurlyFors] | ||
rewrite.redundantBraces.stringInterpolation = true | ||
rewrite.redundantBraces.methodBodies = true | ||
rewrite.redundantBraces.generalExpressions = true | ||
rewriteTokens = { "⇒": "=>", "→": "->", "←": "<-" } |
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 |
---|---|---|
|
@@ -32,17 +32,19 @@ lazy val commonSettings = Seq( | |
Resolver.sonatypeRepo("snapshots") | ||
), | ||
libraryDependencies ++= Seq( | ||
"org.typelevel" %%% "cats-core" % catsVersion, | ||
"org.typelevel" %%% "alleycats-core" % catsVersion, | ||
"com.chuusai" %%% "shapeless" % shapelessVersion, | ||
"org.typelevel" %%% "cats-testkit-scalatest" % testKitVersion % Test, | ||
compilerPlugin("org.typelevel" %% "kind-projector" % "0.11.0" cross CrossVersion.full) | ||
"org.typelevel" %%% "cats-core" % catsVersion, | ||
"org.typelevel" %%% "alleycats-core" % catsVersion, | ||
"com.chuusai" %%% "shapeless" % shapelessVersion, | ||
"org.typelevel" %%% "cats-testkit-scalatest" % testKitVersion % Test, | ||
compilerPlugin(("org.typelevel" %% "kind-projector" % "0.11.0").cross(CrossVersion.full)) | ||
), | ||
scmInfo := | ||
Some(ScmInfo( | ||
url("https://github.com/typelevel/kittens"), | ||
"scm:git:[email protected]:typelevel/kittens.git" | ||
)), | ||
Some( | ||
ScmInfo( | ||
url("https://github.com/typelevel/kittens"), | ||
"scm:git:[email protected]:typelevel/kittens.git" | ||
) | ||
), | ||
testOptions += Tests.Argument("-oF"), | ||
mimaPreviousArtifacts := Set(organization.value %% moduleName.value % "2.0.0") | ||
) ++ crossVersionSharedSources | ||
|
@@ -60,34 +62,38 @@ lazy val commonJvmSettings = Seq( | |
|
||
lazy val coreSettings = buildSettings ++ commonSettings ++ publishSettings ++ releaseSettings | ||
|
||
lazy val root = project.in(file(".")) | ||
lazy val kittens = project | ||
.in(file(".")) | ||
.aggregate(coreJS, coreJVM) | ||
.dependsOn(coreJS, coreJVM) | ||
.settings(coreSettings:_*) | ||
.settings(coreSettings: _*) | ||
.settings(noPublishSettings) | ||
|
||
lazy val core = crossProject(JSPlatform, JVMPlatform).crossType(CrossType.Pure) | ||
lazy val core = crossProject(JSPlatform, JVMPlatform) | ||
.crossType(CrossType.Pure) | ||
.settings(moduleName := "kittens") | ||
.settings(coreSettings:_*) | ||
.jsSettings(commonJsSettings:_*) | ||
.jvmSettings(commonJvmSettings:_*) | ||
|
||
.settings(coreSettings: _*) | ||
.jsSettings(commonJsSettings: _*) | ||
.jvmSettings(commonJvmSettings: _*) | ||
|
||
lazy val coreJVM = core.jvm | ||
lazy val coreJS = core.js | ||
|
||
addCommandAlias("validate", ";root;clean;test;mima;doc") | ||
addCommandAlias("releaseAll", ";root;release") | ||
addCommandAlias("js", ";project coreJS") | ||
addCommandAlias("root", ";project kittens") | ||
addCommandAlias("jvm", ";project coreJVM") | ||
addCommandAlias("root", ";project root") | ||
addCommandAlias("js", ";project coreJS") | ||
|
||
addCommandAlias("validate", "all scalafmtCheckAll scalafmtSbtCheck test doc coreJVM/mimaReportBinaryIssues") | ||
addCommandAlias("fmt", "all scalafmtSbt scalafmtAll") | ||
addCommandAlias("fmtCheck", "all scalafmtSbtCheck scalafmtCheckAll") | ||
addCommandAlias("mima", "coreJVM/mimaReportBinaryIssues") | ||
addCommandAlias("releaseAll", ";root;release") | ||
|
||
lazy val crossVersionSharedSources: Seq[Setting[_]] = | ||
Seq(Compile, Test).map { sc => | ||
(unmanagedSourceDirectories in sc) ++= { | ||
(unmanagedSourceDirectories in sc ).value.map { | ||
dir:File => new File(dir.getPath + "_" + scalaBinaryVersion.value) | ||
(unmanagedSourceDirectories in sc).value.map { dir: File => | ||
new File(dir.getPath + "_" + scalaBinaryVersion.value) | ||
} | ||
} | ||
} | ||
|
@@ -101,9 +107,9 @@ lazy val publishSettings = Seq( | |
publishTo := { | ||
val nexus = "https://oss.sonatype.org/" | ||
if (version.value.trim.endsWith("SNAPSHOT")) | ||
Some("snapshots" at nexus + "content/repositories/snapshots") | ||
Some("snapshots".at(nexus + "content/repositories/snapshots")) | ||
else | ||
Some("releases" at nexus + "service/local/staging/deploy/maven2") | ||
Some("releases".at(nexus + "service/local/staging/deploy/maven2")) | ||
}, | ||
pomExtra := | ||
<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 |
---|---|---|
@@ -1,34 +1,33 @@ | ||
package cats.derived | ||
|
||
/** | ||
* allows semi automatically derive each instance. The derivation might need help when | ||
* there are fields with a type constructor that comes with instances, e.g. | ||
* {{{ | ||
* scala> case class Bar(a: String) | ||
* scala> case class Foo(bars: List[Bar]) | ||
* scala> import cats.instances.all._ | ||
* | ||
* scala> cats.derived.semiauto.show[Foo].show(Foo(List(Bar("a")))) | ||
* res1: String = Foo(bars = \$colon\$colon(head = Bar(a = a), tl\$access\$1 = Nil.type())) | ||
* }}} | ||
* Note that semi.show didn't respect the native `Show[List]` instance | ||
* | ||
* You could either derive a Bar instance first | ||
* {{{ | ||
* scala> implicit val barShow = cats.derived.semi.show[Bar] | ||
* | ||
* scala> cats.derived.semiauto.show[Foo].show(Foo(List(Bar("a")))) | ||
* res2: String = Foo(bars = List(Bar(a = a))) | ||
* }}} | ||
* | ||
* Or you can take advantage of a controlled auto derivation | ||
* {{{ | ||
* scala> implicit val fooShow: Show[Foo] = { | | ||
* import cats.derived.auto.show._ | | ||
* cats.derived.semiauto.show | | ||
* } | ||
* scala> Foo(List(Bar("a"))).show | ||
* res3: String = Foo(bars = List(Bar(a = a))) | ||
* }}} | ||
*/ | ||
/** allows semi automatically derive each instance. The derivation might need help when | ||
* there are fields with a type constructor that comes with instances, e.g. | ||
* {{{ | ||
* scala> case class Bar(a: String) | ||
* scala> case class Foo(bars: List[Bar]) | ||
* scala> import cats.instances.all._ | ||
* | ||
* scala> cats.derived.semiauto.show[Foo].show(Foo(List(Bar("a")))) | ||
* res1: String = Foo(bars = \$colon\$colon(head = Bar(a = a), tl\$access\$1 = Nil.type())) | ||
* }}} | ||
* Note that semi.show didn't respect the native `Show[List]` instance | ||
* | ||
* You could either derive a Bar instance first | ||
* {{{ | ||
* scala> implicit val barShow = cats.derived.semi.show[Bar] | ||
* | ||
* scala> cats.derived.semiauto.show[Foo].show(Foo(List(Bar("a")))) | ||
* res2: String = Foo(bars = List(Bar(a = a))) | ||
* }}} | ||
* | ||
* Or you can take advantage of a controlled auto derivation | ||
* {{{ | ||
* scala> implicit val fooShow: Show[Foo] = { | | ||
* import cats.derived.auto.show._ | | ||
* cats.derived.semiauto.show | | ||
* } | ||
* scala> Foo(List(Bar("a"))).show | ||
* res3: String = Foo(bars = List(Bar(a = a))) | ||
* }}} | ||
*/ | ||
object semiauto extends SemiAutoInstances |
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
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
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
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
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
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
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
Oops, something went wrong.