-
-
Save barambani/29c8bf74680b87ee7668eb702c2ff812 to your computer and use it in GitHub Desktop.
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
trait Stream[+F[_], +A] | |
object Stream { | |
// Make scalac get over its oudenophobia. | |
type Nothing2[X] <: Nothing | |
def emits[F[x] >: Nothing2[x], A](as: List[A]): Stream[F, A] = new Stream[F, A] {} | |
implicit class InvariantOps[F[x] >: Nothing2[x], A](private val self: Stream[F, A]) extends AnyVal { | |
def ethrough[B](p: Stream[F, A] => Stream[F, B]): Stream[F, B] = p(self) | |
} | |
} | |
object Test { | |
val a = Stream.emits(List(1)).ethrough(identity) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment