Skip to content

Instantly share code, notes, and snippets.

@retronym
Created January 18, 2010 18:49
Show Gist options
  • Select an option

  • Save retronym/280253 to your computer and use it in GitHub Desktop.

Select an option

Save retronym/280253 to your computer and use it in GitHub Desktop.
Monad vs Applicative Functor
import scalaz._
import Scalaz._
val o1 = some(1)
val o2 = some(2)
val v1 = o1.<⊛>(o2, (_: Int) + (_: Int))
println(v1)
val v2 = for {
a <- o1
b <- o2 // more complex, because `a` is visible here, but not needed
} yield a + b
println(v2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment