-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR does a few things: * Renames Stream/StreamT to Streaming/StreamingT * Sets up some law-checking for Stream and StreamingT * Adds some type class instances * Fixes Stream#filter bug One issue which was pointed out in the PR is that some methods on StreamingT[F, ?] require F to be trampolined. For types like Option which are not trampolined, this will result in StackOverflowExceptions (and thus failed law-checking) during some operations. I don't have a 100% satisfactory answer to this right now. I'd love to come up with a design that is completely safe but don't see how it can be done in general. Still left to do: * Update documentation * Comprehensive type class definitions for Streaming/StreamingT. * Do some benchmarking on Streaming/StreamingT overhead. * More unit tests for Streaming/StreamingT
- Loading branch information
Showing
9 changed files
with
258 additions
and
107 deletions.
There are no files selected for viewing
244 changes: 160 additions & 84 deletions
244
core/src/main/scala/cats/data/Stream.scala → .../src/main/scala/cats/data/Streaming.scala
Large diffs are not rendered by default.
Oops, something went wrong.
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
11 changes: 11 additions & 0 deletions
11
tests/shared/src/test/scala/cats/tests/StreamingTTests.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,11 @@ | ||
package cats | ||
package tests | ||
|
||
import cats.data.StreamingT | ||
import cats.laws.discipline.{EqK, MonadTests, SerializableTests} | ||
|
||
class StreamingTTests extends CatsSuite { | ||
implicit val e: Eq[StreamingT[Eval, Int]] = EqK[StreamingT[Eval, ?]].synthesize[Int] | ||
checkAll("StreamingT[Eval, ?]", MonadTests[StreamingT[Eval, ?]].monad[Int, Int, Int]) | ||
checkAll("Monad[StreamingT[Eval, ?]]", SerializableTests.serializable(Monad[StreamingT[Eval, ?]])) | ||
} |
17 changes: 17 additions & 0 deletions
17
tests/shared/src/test/scala/cats/tests/StreamingTests.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,17 @@ | ||
package cats | ||
package tests | ||
|
||
import cats.data.Streaming | ||
import cats.laws.discipline.arbitrary._ | ||
import cats.laws.discipline.{TraverseTests, CoflatMapTests, MonadCombineTests, SerializableTests} | ||
|
||
class StreamingTests extends CatsSuite { | ||
checkAll("Streaming[Int]", CoflatMapTests[Streaming].coflatMap[Int, Int, Int]) | ||
checkAll("CoflatMap[Streaming]", SerializableTests.serializable(CoflatMap[Streaming])) | ||
|
||
checkAll("Streaming[Int]", MonadCombineTests[Streaming].monadCombine[Int, Int, Int]) | ||
checkAll("MonadCombine[Streaming]", SerializableTests.serializable(MonadCombine[Streaming])) | ||
|
||
checkAll("Streaming[Int] with Option", TraverseTests[Streaming].traverse[Int, Int, Int, Int, Option, Option]) | ||
checkAll("Traverse[Streaming]", SerializableTests.serializable(Traverse[Streaming])) | ||
} |