Skip to content
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

Streaming and StreamingT extend Product with Serializable #648

Merged
merged 1 commit into from
Nov 15, 2015

Conversation

ceedubs
Copy link
Contributor

@ceedubs ceedubs commented Nov 15, 2015

This helps type inference by fixing the least upper bound of subtypes of
Streaming(T).

Before:

scala> val x = if (true) Cons(1, Now(Streaming.empty[Int])) else Streaming.Empty[Int]()
x: Product with Serializable with cats.data.Streaming[Int] = Streaming(1, ...)

After:

scala> val x = if (true) Cons(1, Now(Streaming.empty[Int])) else Streaming.Empty[Int]()
x: cats.data.Streaming[Int] = Streaming(1, ...)

This helps type inference by fixing the least upper bound of subtypes of
Streaming(T).

Before:
```scala
scala> val x = if (true) Cons(1, Now(Streaming.empty[Int])) else Streaming.Empty[Int]()
x: Product with Serializable with cats.data.Streaming[Int] = Streaming(1, ...)
```

After:
```scala
scala> val x = if (true) Cons(1, Now(Streaming.empty[Int])) else Streaming.Empty[Int]()
x: cats.data.Streaming[Int] = Streaming(1, ...)
```
@hakuch
Copy link

hakuch commented Nov 15, 2015

Off-topic comment: There was a brief conversation on the Gitter channel on the need to explicitly inherit from Product and Serializable in the base trait or class when the sub-classes are case classes in order to produce a more helpful "least upper-bound". I wish there was first-class support in Scala for algabraic data types like in Haskell or OCaml. Do intersection types in Dotty address this?

@codecov-io
Copy link

Current coverage is 77.19%

Merging #648 into master will not affect coverage as of 1652b4a

@@            master    #648   diff @@
======================================
  Files          159     159       
  Stmts         2083    2083       
  Branches        70      70       
  Methods          0       0       
======================================
  Hit           1608    1608       
  Partial          0       0       
  Missed         475     475       

Review entire Coverage Diff as of 1652b4a

Powered by Codecov. Updated on successful CI builds.

@ceedubs
Copy link
Contributor Author

ceedubs commented Nov 15, 2015

@hakuch That's an interesting question. I haven't really read up on Dotty yet. Someone else might have an answer for that.

@fthomas
Copy link
Member

fthomas commented Nov 15, 2015

👍

1 similar comment
@stew
Copy link
Contributor

stew commented Nov 15, 2015

👍

stew added a commit that referenced this pull request Nov 15, 2015
Streaming and StreamingT extend Product with Serializable
@stew stew merged commit 8d02f0a into typelevel:master Nov 15, 2015
@stew stew removed the in progress label Nov 15, 2015
@ceedubs ceedubs deleted the streaming-prod-ser branch November 15, 2015 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants