Skip to content

Instantly share code, notes, and snippets.

@arjanblokzijl
Created October 11, 2011 17:20
Show Gist options
  • Save arjanblokzijl/1278729 to your computer and use it in GitHub Desktop.
Save arjanblokzijl/1278729 to your computer and use it in GitHub Desktop.
most basic monad state transformer example
scala> for (s <- stateT[Int, Option, String](i => Some(("aaa", i + 1)))) yield(s + "bbb")
res0: scalaz.StateT[Int,Option,java.lang.String] = scalaz.StateTs$$anon$1@4f837a5b
scala> res0.runT(10)
res31: Option[(java.lang.String, Int)] = Some((aaabbb,11))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment