-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use simulacrum for typeclass boilerplate #806
Conversation
This may provide the following benefits: 1) It should be a bit more efficient. 2) It removes the need to `import cats.std.function._` for some operations, which may make it a bit more newcomer friendly. 3) We are already using Eval for things like foldRight, so it seems more consistent to use it for `State`. 4) I think it's a bit easier to explain `Eval` than `Trampoline`, since it's hard to explain the latter without first explaining `Free`. So again, this may be a bit more newcomer friendly.
Also add the missing `coproduct` syntax `object`.
Use Eval instead of Trampoline for State
- Also remove unused type parameter in sequence_
factor out a static inner method from typelevel#769 for better GC
As reported by @liff [here](https://gitter.im/non/cats?at=5694ce218fdd3c0c382e20f1).
Add traverseU_ and sequenceU_
Fix StreamingT.filter bug
Topic/arrow scaladoc
Fix order of effects in FreeApplicative.foldMap
Add ScalaDoc for MonadCombine unite syntax
Add ScalaDoc for Either syntax
Add ScalaDoc examples for Coproduct syntax
Add ScalaDoc example for foldK syntax
Question: is the apply method generated by simulacrum also @inline marked?
@mpilquist I did as you suggested, and sbt validate runs locally. So let's see if travis agrees. |
Here is the POM: <?xml version='1.0' encoding='UTF-8'?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>org.spire-math</groupId>
<artifactId>cats-kernel_2.11</artifactId>
<packaging>jar</packaging>
<description>kernel</description>
<url>https://github.com/non/cats</url>
<version>0.4.0-SNAPSHOT</version>
<licenses>
<license>
<name>MIT</name>
<url>http://opensource.org/licenses/MIT</url>
<distribution>repo</distribution>
</license>
</licenses>
<name>kernel</name>
<organization>
<name>org.spire-math</name>
<url>https://github.com/non/cats</url>
</organization>
<scm>
<url>https://github.com/non/cats</url>
<connection>scm:git:git@github.com:non/cats.git</connection>
</scm>
<developers>
<developer>
<id>non</id>
<name>Erik Osheim</name>
<url>http://github.com/non/</url>
</developer>
</developers>
<properties>
<info.apiURL>https://non.github.io/cats/api/</info.apiURL>
</properties>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.11.7</version>
</dependency>
<dependency>
<groupId>org.scoverage</groupId>
<artifactId>scalac-scoverage-runtime_2.11</artifactId>
<version>1.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.scoverage</groupId>
<artifactId>scalac-scoverage-plugin_2.11</artifactId>
<version>1.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.mpilquist</groupId>
<artifactId>simulacrum_2.11</artifactId>
<version>0.5.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project> |
OK cool. We can remove the reference from the POM by using the pomPostProcess setting. I'm away from a computer now but I can post an example later. Alternatively, take a look at the build settings class in scodec-build.
|
This gets rid of the simulacrum dependency, as well as the strange and definitely unneeded scoverage dependencies, resulting in a nice and clean .pom Code taken from scodec-build. Thanks @mpilquist
The .pom after removing all provided deps (including the very weird scoverage deps). @johnynek does this look OK to you? I think once we switch over to typeclassic there will be one additional dependency. <?xml version='1.0' encoding='UTF-8'?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>org.spire-math</groupId>
<artifactId>cats-kernel_2.11</artifactId>
<packaging>jar</packaging>
<description>kernel</description>
<url>https://github.com/non/cats</url>
<version>0.4.0-SNAPSHOT</version>
<licenses>
<license>
<name>MIT</name>
<url>http://opensource.org/licenses/MIT</url>
<distribution>repo</distribution>
</license>
</licenses>
<name>kernel</name>
<organization>
<name>org.spire-math</name>
<url>https://github.com/non/cats</url>
</organization>
<scm>
<url>https://github.com/non/cats</url>
<connection>scm:git:git@github.com:non/cats.git</connection>
</scm>
<developers>
<developer>
<id>non</id>
<name>Erik Osheim</name>
<url>http://github.com/non/</url>
</developer>
</developers>
<properties>
<info.apiURL>https://non.github.io/cats/api/</info.apiURL>
</properties>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.11.7</version>
</dependency>
</dependencies>
</project> |
…rror Add ApplicativeError
…uffer instead of ArrayBuffer
…plementation in order to use VectorBuilder instead of ListBuffer
…atmap-typeclass-instance-to-vector Request to Add CoflatMap Instance for Vector
…erializable by default
Update list of authors
Upgrade to simulacrum 0.6.1
Also remove unnecessary extends Serializable
@rklaehn thanks a bunch for this work! What's the current status of this? @mpilquist, @johnynek, @milessabin does it look good to you? |
👍 |
👍 I guess. This PR is huge and I am not confident that I see all that is going on, To be clear: I'm happy to use simulacrum here as long as consumers of the library see 0 additions deps to use the code. I understand the |
@johnynek yes, the provided dependency on simulacrum is not needed at runtime. That is why it is removed from the .pom. |
👍 @rklaehn sorry there are merge conflicts. If you fix them and leave a comment that you have updated the PR, I'll try to merge before more conflicts pop up. |
@rklaehn Thanks for the work on this! |
The removal of provided artefacts is done inline because it is used in only one place.
@ceedubs the merge conflict was because mima was configured on topic/kernel. It should be fixed now. I am doing a talk about spire and the typelevel ecosystem at my local scala user group in munich on 2016-03-08. It would be great if algebra and spire on master would depend on cats-kernel at that time, so I could report something positive... :-) |
Use simulacrum for typeclass boilerplate
Thanks @rklaehn! |
This PR hides the simulacrum dependency from the pom and uses the typeclass annotation on all typeclasses. It also removes some manually added code that is now generated by simulacrum.
Review by @mpilquist or @milessabin if possible. It would be good if @johnynek could look at the generated code with an eye on algebra/algebird compatibility.