-
-
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
2.13.0-RC1 #2792
Merged
Merged
2.13.0-RC1 #2792
Changes from 13 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
61718f3
Remove catalysts dependency
travisbrown b766494
Fix typo
travisbrown 46ef642
Fix platform-specific stuff in alleycats
travisbrown 7c6c243
Ugh, fix import
travisbrown 2311c79
Format
travisbrown d1666de
move to Scala 2.13.0-RC1 (drop -M5)
SethTisue 757c13b
Thanks to ScalaTest we temporarily need to use deprecated classes
travisbrown 7942148
Fix Hash instances to match changes in 2.13
travisbrown 7fdb2ce
Fix for 2.11
travisbrown d28da64
One last fix for 2.13
travisbrown abc53ce
Fix Hash instances in cats-core for 2.13
travisbrown a27ecfe
Tell scalastyle to ignore returns in copy-pasted MurmurHash3 code
travisbrown 5031281
Merge branch 'master' into update/2.13.0-RC1
travisbrown 8cd5abb
Merge branch 'master' into update/2.13.0-RC1
kailuowang 143a62b
Format build.sbt
travisbrown File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
18 changes: 18 additions & 0 deletions
18
alleycats-tests/js/src/test/scala/alleycats/tests/TestSettings.scala
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,18 @@ | ||
package alleycats | ||
package tests | ||
|
||
import org.scalactic.anyvals.{PosInt, PosZDouble, PosZInt} | ||
import org.scalatest.Matchers | ||
import org.scalatest.prop.Configuration | ||
|
||
trait TestSettings extends Configuration with Matchers { | ||
|
||
lazy val checkConfiguration: PropertyCheckConfiguration = | ||
PropertyCheckConfiguration( | ||
minSuccessful = PosInt(5), | ||
maxDiscardedFactor = PosZDouble(50.0), | ||
minSize = PosZInt(0), | ||
sizeRange = PosZInt(5), | ||
workers = PosInt(1) | ||
) | ||
} |
18 changes: 18 additions & 0 deletions
18
alleycats-tests/jvm/src/test/scala/alleycats/tests/TestSettings.scala
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,18 @@ | ||
package alleycats | ||
package tests | ||
|
||
import org.scalactic.anyvals.{PosInt, PosZDouble, PosZInt} | ||
import org.scalatest.Matchers | ||
import org.scalatest.prop.Configuration | ||
|
||
trait TestSettings extends Configuration with Matchers { | ||
|
||
lazy val checkConfiguration: PropertyCheckConfiguration = | ||
PropertyCheckConfiguration( | ||
minSuccessful = PosInt(50), | ||
maxDiscardedFactor = PosZDouble(5.0), | ||
minSize = PosZInt(0), | ||
sizeRange = PosZInt(10), | ||
workers = PosInt(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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package cats.platform | ||
|
||
private[cats] object Platform { | ||
// using `final val` makes compiler constant-fold any use of these values, dropping dead code automatically | ||
// $COVERAGE-OFF$ | ||
final val isJvm = false | ||
final val isJs = true | ||
// $COVERAGE-ON$ | ||
} |
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,9 @@ | ||
package cats.platform | ||
|
||
private[cats] object Platform { | ||
// using `final val` makes compiler constant-fold any use of these values, dropping dead code automatically | ||
// $COVERAGE-OFF$ | ||
final val isJvm = true | ||
final val isJs = false | ||
// $COVERAGE-ON$ | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
53 changes: 53 additions & 0 deletions
53
kernel/src/main/scala-2.12-/cats/kernel/compat/HashCompat.scala
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,53 @@ | ||
package cats | ||
package kernel | ||
package compat | ||
|
||
private[kernel] class HashCompat { | ||
// Adapted from scala.util.hashing.MurmurHash#productHash. | ||
private[kernel] def product1HashWithPrefix(_1Hash: Int, prefix: String): Int = { | ||
import scala.util.hashing.MurmurHash3._ | ||
var h = productSeed | ||
h = mix(h, _1Hash) | ||
finalizeHash(h, 1) | ||
} | ||
|
||
// Adapted from scala.util.hashing.MurmurHash#productHash. | ||
private[cats] def product2HashWithPrefix(_1Hash: Int, _2Hash: Int, prefix: String): Int = { | ||
import scala.util.hashing.MurmurHash3._ | ||
var h = productSeed | ||
h = mix(h, _1Hash) | ||
h = mix(h, _2Hash) | ||
finalizeHash(h, 2) | ||
} | ||
|
||
private[cats] def updateUnorderedHashC(c: Int, h: Int): Int = if (h != 0) c * h else c | ||
|
||
// adapted from [[scala.util.hashing.MurmurHash3]], | ||
// but modified standard `Any#hashCode` to `ev.hash`. | ||
def listHash[A](x: List[A])(implicit A: Hash[A]): Int = { | ||
import scala.util.hashing.MurmurHash3._ | ||
var n = 0 | ||
var h = seqSeed | ||
var elems = x | ||
while (!elems.isEmpty) { | ||
val head = elems.head | ||
val tail = elems.tail | ||
h = mix(h, A.hash(head)) | ||
n += 1 | ||
elems = tail | ||
} | ||
finalizeHash(h, n) | ||
} | ||
|
||
// adapted from scala.util.hashing.MurmurHash3 | ||
def orderedHash[A](xs: TraversableOnce[A])(implicit A: Hash[A]): Int = { | ||
import scala.util.hashing.MurmurHash3._ | ||
var n = 0 | ||
var h = seqSeed | ||
xs.foreach { x => | ||
h = mix(h, A.hash(x)) | ||
n += 1 | ||
} | ||
finalizeHash(h, n) | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, was this an optimization opportunity you happen to come across or was it broken on RC1?
Also would it be simpler to just call
fa.ap(f)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is from @SethTisue's commit, but the issue is that 2.13 sees the
ap
definitions inFlatMap
andWriterTApply
as conflicting. I personally think picking out the appropriate implementation viasuper
is the right thing to do in this case, but I also don't think it matters much, and am happy to change it tofa.ap(f)
if you'd prefer.