Bohtvaroh

Blogger - Scalaz Motivation - 10

Jun 1st, 2012
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.24 KB | None | 0 0
  1. trait FoldLeft[M[_]] {
  2.   def foldLeft[A, B](ma: M[A], b: B, op: (B, A) => B): B
  3. }
  4.  
  5. object FoldLeft {
  6.   implicit object ListFoldLeft extends FoldLeft[List] {
  7.     def foldLeft[A, B](ma: List[A], b: B, op: (B, A) => B) = ma.foldLeft(b)(op)
  8.   }
  9. }
Advertisement
Add Comment
Please, Sign In to add comment