Last active
December 31, 2015 22:09
-
-
Save YoEight/8051960 to your computer and use it in GitHub Desktop.
scalaz.Process and Free equiv. using simple structure encoding
This file contains hidden or 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
| sealed trait Free[F[_], A] | |
| case class Return[F[_], A](v: A) extends Free[F, A] | |
| case class Suspend[F[_], A](s: F[Free[F, A]]) extends Free[F, A] | |
| sealed trait ProcessB[T[_], O, B] | |
| case class Emit[T[_], O, B](o: O, next: B) extends ProcessB[T, O, B] | |
| case class Await[T[_], A, O, B](ta: T[A], k: A => B) extends ProcessB[T, O, B] | |
| case class Stop[T[_], O, B] extends ProcessB[T, O, B] | |
| type Process[T[_], O] = Free[({ type F[x] = ProcessB[T,O,x] })#F, O] |
Author
Ok I agree with you!
But what can't you do with iteratee from these 3 points? (trying to find the bad arguments :))
you don't really control the source in iteratee, but you can control the output!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, but I see no benefit.
That's the key. Process abstracts the way you get an 'A', allowing a lot of reuse (ex: Process1, Tye, Wye). Process also lets its driver (i.e interpreter) decides how it want to deal the result. ex: