IterableCpsMonad

cps.monads.IterableCpsMonad
class IterableCpsMonad[C <: (IterableOnce)](iterableFactory: IterableFactory[C]) extends CpsThrowMonad[C] with CpsMonadInstanceContext[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 CpsMonad[C]
trait CpsAwaitable[C]
class Object
trait Matchable
class Any

Members list

Concise view

Type members

Inherited types

type WF[X] = F[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

def adoptAwait[A](fa: C[A]): F[A]

If is it statically known, that monad is evaluated in this context, then this call is completely eliminated by dotty-cps-async macro

If is it statically known, that monad is evaluated in this context, then this call is completely eliminated by dotty-cps-async macro

Attributes

Returns:

fa

Inherited from:
CpsMonadInstanceContext
def apply[T](op: Context => C[T]): F[T]

run with this instance

run with this instance

Attributes

Inherited from:
CpsMonadInstanceContext
def lazyPure[T](op: => T): F[T]

Lazy variant of pure, which by default - create monadic expression according to the choosen monad types. (i.e. delaing for effect monads, starting for eager monand, pure by defiault)

Lazy variant of pure, which by default - create monadic expression according to the choosen monad types. (i.e. delaing for effect monads, starting for eager monand, pure by defiault)

Attributes

Inherited from:
CpsMonad