Questions tagged «fs2»

1
如何解释Scala Cats / fs2中的堆栈安全性?
这是fs2文档中的一段代码。该函数go是递归的。问题是我们如何知道它是否是堆栈安全的,以及如何推断任何函数是否是堆栈安全的? import fs2._ // import fs2._ def tk[F[_],O](n: Long): Pipe[F,O,O] = { def go(s: Stream[F,O], n: Long): Pull[F,O,Unit] = { s.pull.uncons.flatMap { case Some((hd,tl)) => hd.size match { case m if m <= n => Pull.output(hd) >> go(tl, n - m) case m => Pull.output(hd.take(n.toInt)) >> Pull.done } case None …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.