Skip to content

Instantly share code, notes, and snippets.

@kclay
Created August 23, 2014 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kclay/063b321e9ec610c003be to your computer and use it in GitHub Desktop.
Save kclay/063b321e9ec610c003be to your computer and use it in GitHub Desktop.
class ToFunctional[T, A >: Var](seq: Sequence[T]) {
def concatMap[B <: Typed, Inner](f: A => B)(implicit cm: CanMap[T, B, Inner]) = ConcatMap[Inner](seq.underlying, FuncWrap(f))
def map[B <: Typed, Inner](f: A => B)(implicit cm: CanMap[T, B, Inner]) = RMap[Inner](seq.underlying, FuncWrap(f))
def reduce[P](f: (A, A) =>Produce0[P])(implicit =:!=[T, ChangeCursor[_]] = Reduce[T,P](seq.underlying, f)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment