-
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
71 changed files
with
983 additions
and
842 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,15 @@ | ||
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,23 +62,24 @@ lazy val commonJvmSettings = Seq( | |
|
||
lazy val coreSettings = buildSettings ++ commonSettings ++ publishSettings ++ releaseSettings | ||
|
||
lazy val root = project.in(file(".")) | ||
lazy val root = 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("validate", ";root;clean;scalafmtCheckAll;test;mima;doc") | ||
addCommandAlias("releaseAll", ";root;release") | ||
addCommandAlias("js", ";project coreJS") | ||
addCommandAlias("jvm", ";project coreJVM") | ||
|
@@ -86,8 +89,8 @@ addCommandAlias("mima", "coreJVM/mimaReportBinaryIssues") | |
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 +104,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.