Skip to content

Instantly share code, notes, and snippets.

@windymelt
Created February 8, 2014 16:48
Show Gist options
  • Save windymelt/8886521 to your computer and use it in GitHub Desktop.
Save windymelt/8886521 to your computer and use it in GitHub Desktop.
unfold_example1
import scalaz.std.stream._
import scalaz.syntax.id._
unfold(0)(failable(_).map(_.squared)).force // => Stream(1, 2, 3, 4, 5, ..., 99, 100)
unfold(0)(failable(_).map(n => (s"n=${n}", n))).force // => Stream("n=1", "n=2", ... "n=100")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment