IterableCpsMonad

cps.monads.IterableCpsMonad
class IterableCpsMonad[C <: (IterableOnce)](iterableFactory: IterableFactory[C]) extends CpsThrowMonad[C], CpsThrowMonadInstanceContext[C]

Monad for iterable collection. typical usage:

  def allpairs[A](l:List[A]):List((A,A)) = reify[List] {
      (reflect(l),reflect(l))
  }

Attributes

Graph
Supertypes
trait CpsThrowMonad[C]
trait CpsThrowSupport[C]
trait CpsMonad[C]
class Object
trait Matchable
class Any
Show all

Members list

Type members

Inherited types

Attributes

Inherited from:
CpsThrowMonadInstanceContext
type WF[X] = C[X]

Attributes

Inherited from:
CpsMonad

Value members

Concrete methods

def error[A](e: Throwable): C[A]

represent error e in monadic context.

represent error e in monadic context.

Attributes

override def flatMap[A, B](fa: C[A])(f: A => C[B]): C[B]

bind combinator, which compose f over fa

bind combinator, which compose f over fa

Attributes

Definition Classes
override def map[A, B](fa: C[A])(f: A => B): C[B]

map a function f over fa

map a function f over fa

Attributes

Definition Classes
override def pure[A](a: A): C[A]

Pure - wrap value t inside monad.

Pure - wrap value t inside monad.

Note, that pure use eager evaluation, which is different from Haskell.

Attributes

Definition Classes

Inherited methods

override def apply[T](op: Context => C[T]): C[T]

run op in the context environment.

run op in the context environment.

Attributes

Definition Classes
Inherited from:
CpsThrowMonadInstanceContext
def flatWrap[T](op: => C[T]): C[T]

Wrap and flatten of monadic expression..

Wrap and flatten of monadic expression..

Attributes

Inherited from:
CpsMonad
def flatten[T](ffa: C[C[T]]): C[T]

Attributes

Inherited from:
CpsMonad
def wrap[T](op: => T): C[T]

Create monadic expression according to the default operation of choosen monad types. (i.e. delaying for effect monads, starting for eager monand, pure by default)

Create monadic expression according to the default operation of choosen monad types. (i.e. delaying for effect monads, starting for eager monand, pure by default)

Attributes

Inherited from:
CpsMonad