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 Iterant.dropLast #495

alexandru opened this Issue Jan 7, 2018 · 4 comments


None yet
3 participants

alexandru commented Jan 7, 2018

We need an Iterant op that drops the last n: Int elements from the stream.

The method signature should be something like this:

sealed abstract class Iterant[F[_], A] {
  // ...
  def dropLast(n: Int)(implicit F: Sync[F]): Iterant[F, A]

For inspiration check out DropLastOperator, the implementation for Observable.


This comment has been minimized.

martin-g commented Jan 7, 2018

Sorry for the noise but what is the idea behind re-using F in implicit F: Sync[F] ?
Why the method parameter (implicit F) is named the same as the type parameter (F[_]) ?


This comment has been minimized.


alexandru commented Jan 7, 2018

@martin-g it's just a convention that I've seen in other Scala codebases and that I also adopted, related to typeclasses. I first saw it in and also in FS2.

It's very subjective, but I think it's nice to then see in the implementation things like ...

Which I sometimes prefer instead of using cats.syntax.

Syntactically I immediately see that, OK we've got type F which needs to implement Sync. When you first see it, might seem awkward, but it grows on you :-)


This comment has been minimized.


Avasil commented Jan 8, 2018

fyi I'm working on this issue :)


This comment has been minimized.


alexandru commented Jan 9, 2018

@Avasil 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment