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

Add type-class hierarchy, to be integrated with both Cats and Scalaz #140

Closed
alexandru opened this issue Apr 8, 2016 · 1 comment
Closed
Milestone

Comments

@alexandru
Copy link
Member

Related to ticket #89, we are introducing a type-class hierarchy that should express Monix's exposed types (Task, Coeval, Observable).

  1. the purpose isn't to replace libraries like Cats or Scalaz, but because the core depending on such a library is undesirable, the approach is to provide "shims" for Monad and Applicative and then convert those, inspired by djspiewak/shims
  2. the exposed type-classes need to cover Monix's exposed functionality and nothing else
  3. the integration with Cats and Scalaz will be at the top of the stack

This integration is actually more difficult than anticipated, because it requires type-class design and research. Hence I'm pushing it for a later 2.1 release. 2.0 will contain a simplified hierarchy of type-classes that covers the monix.eval.

Thus we currently have:

  • monix.types.Zippable: for functors supporting the zip / zipWith operations
  • monix.types.Recoverable: equivalent of MonadError
  • monix.types.Deferrable: for monadic contexts in which we can lift non-strict values (e.g. now vs evalOnce, evalAlways), that can be deferred and whose results can be memoized
  • monix.types.Evaluable: for monadic contexts that will eventually produce a single value as a result, either synchronously or asynchronously (e.g. both Task and Coeval are Evaluable but not Observable)
  • monix.types.Restartable: computations that can be restarted (e.g. Task, Coeval and Observable are all restartable, a java.lang.Iterable would also be restartable, but a java.lang.Iterator wouldn't be restartable (or a Scala Stream for that matter)
  • monix.types.Asynchronous: computations that execute asynchronously, that can have delayed execution or result signaling and that are recoverable
  • monix.types.ReactivePublisher: data sources that can be converted to org.reactivestreams.Publisher (e.g. Observable, Task)

This list is subject to change and these types considered slightly unstable. This list is settled for 2.0 though, new types will be added in 2.1 to cover streaming (e.g. async foldable, etc.).

@alexandru
Copy link
Member Author

Shipped in 2.0-M2.

@alexandru alexandru added this to the 2.0 milestone Apr 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant