Skip to content

Instantly share code, notes, and snippets.

@arosien
Created January 31, 2012 18:41
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arosien/1712108 to your computer and use it in GitHub Desktop.
Save arosien/1712108 to your computer and use it in GitHub Desktop.
scalaz operator cheat sheet
F[A] // A is a Functor
M[A] // A is a Monad
fa: F[A], a: A // variables used below
fa1 |+| fa2 // binary append (SemiGroup)
fa1 >| fa2 // map (Functor)
fa1 >>= fa2 // flatmap (Bind)
fa1 |>| fa2 // foreach (Each)
fa <**> fb { (a, b) => c } // apply, produces F[C]
fa |@| fb |@| fc |@| ... { (a, b, c, ...) => x } // apply, produces F[X]
(a => fb) >=> (b => fc) >=> ... (w => fx) // compose, produces F[X]
// more to come...
@hitch17
Copy link

hitch17 commented Jan 31, 2012

Awesome. I was looking for a better way to write more perl in my java projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment