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

Source
IterableCpsMonad.scala
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

type WF[X] = C[X]

Attributes

Inherited from:
CpsMonad
Source
CpsMonad.scala

Value members

Concrete methods

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

represent error e in monadic context.

represent error e in monadic context.

Attributes

Source
IterableCpsMonad.scala
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
Source
IterableCpsMonad.scala
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
Source
IterableCpsMonad.scala
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
Source
IterableCpsMonad.scala

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
Source
CpsMonadContext.scala
def flatWrap[T](op: => C[T]): C[T]

Wrap and flatten of monadic expression..

Wrap and flatten of monadic expression..

Attributes

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

Attributes

Inherited from:
CpsMonad
Source
CpsMonad.scala
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
Source
CpsMonad.scala