CpsLogicMonadInstanceContext

cps.monads.logic.CpsLogicMonadInstanceContext

Attributes

Graph
Supertypes
trait CpsLogicMonad[M]
trait CpsTryMonad[M]
trait CpsTrySupport[M]
trait CpsThrowMonad[M]
trait CpsThrowSupport[M]
trait CpsMonad[M]
class Object
trait Matchable
class Any
Show all
Known subtypes

Members list

Type members

Types

Inherited types

type Observer[A]

Monad, which can be used to observe values of computation and can be used in map/flatMap/... operations. Usefull for cases, where we should mix logic and async operations. If implementation is LogicStream[F[_],A], that Observer is F[_].

Monad, which can be used to observe values of computation and can be used in map/flatMap/... operations. Usefull for cases, where we should mix logic and async operations. If implementation is LogicStream[F[_],A], that Observer is F[_].

Attributes

Inherited from:
CpsLogicMonad
type WF[X] = M[X]

Attributes

Inherited from:
CpsMonad

Value members

Concrete methods

override def apply[T](op: (CpsLogicMonadInstanceContextBody[M]) => M[T]): M[T]

run op in the context environment.

run op in the context environment.

Attributes

Definition Classes

Inherited methods

def empty[A]: M[A]

empty solution set. (same as 'mzero')

empty solution set. (same as 'mzero')

Attributes

Inherited from:
CpsLogicMonad
def error[A](e: Throwable): M[A]

represent error e in monadic context.

represent error e in monadic context.

Attributes

Inherited from:
CpsTryMonad
def fairFlatMap[A, B](ma: M[A], mb: A => M[B]): M[B]

Can be viewed as fair And -- flatMap results are mixed over the all choices in ma

Can be viewed as fair And -- flatMap results are mixed over the all choices in ma

  • in haskell LogicT

Attributes

Inherited from:
CpsLogicMonad
def flatMap[A, B](fa: M[A])(f: A => M[B]): M[B]

bind combinator, which compose f over fa

bind combinator, which compose f over fa

Attributes

Inherited from:
CpsMonad
def flatMapTry[A, B](fa: M[A])(f: (Try[A]) => M[B]): M[B]

flatMap over result of checked evaluation of A

flatMap over result of checked evaluation of A

Attributes

Inherited from:
CpsTryMonad
def flatWrap[T](op: => M[T]): M[T]

Wrap and flatten of monadic expression..

Wrap and flatten of monadic expression..

Attributes

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

Attributes

Inherited from:
CpsMonad
def flattenObserver[A](fma: Observer[M[A]]): M[A]

Flatten observer into computation.

Flatten observer into computation.

Value parameters

fma
  • observer to flatten

Attributes

Returns
  • computation, which adopt observer wrapper
Inherited from:
CpsLogicMonad
def fromCollection[A](collect: IterableOnce[A]): M[A]

Attributes

Inherited from:
CpsLogicMonad
def fromTry[A](r: Try[A]): M[A]

transform r into pure value or error.

transform r into pure value or error.

Attributes

Inherited from:
CpsTryMonad
def fsplit[A](c: M[A]): Observer[Option[(Try[A], M[A])]]

Split computation into part, which return as first value and rest of computation and return this as observer.

Split computation into part, which return as first value and rest of computation and return this as observer.

Attributes

Inherited from:
CpsLogicMonad
def ifte[A, B](a: M[A], thenp: A => M[B], elsep: => M[B]): M[B]

ifte -- if/then/else which works not on boolean condition, but on existence of values in computation.

ifte -- if/then/else which works not on boolean condition, but on existence of values in computation.

Value parameters

a
  • computation to check
elsep
  • what to do if a is empty
thenp
  • what to do after a

Attributes

Inherited from:
CpsLogicMonad
def interleave[A](a: M[A], b: M[A]): M[A]

Can be viewed as fair Or -- values from both computations are interleaved

Can be viewed as fair Or -- values from both computations are interleaved

Attributes

Inherited from:
CpsLogicMonad
def mFoldLeftWhile[A, B](ma: M[A], zero: B, p: B => Boolean)(op: (B, A) => B): Observer[B]

Attributes

Inherited from:
CpsLogicMonad
def mFoldLeftWhileM[A, B](ma: M[A], zero: Observer[B], p: B => Boolean)(op: (Observer[B], Observer[A]) => Observer[B]): Observer[B]

Attributes

Inherited from:
CpsLogicMonad
def mObserveN[A](ma: M[A], n: Int): Observer[IndexedSeq[A]]

Attributes

Inherited from:
CpsLogicMonad
def mObserveOne[A](ma: M[A]): Observer[Option[A]]

Attributes

Inherited from:
CpsLogicMonad
def map[A, B](fa: M[A])(f: A => B): M[B]

map a function f over fa

map a function f over fa

Attributes

Inherited from:
CpsMonad
def mapTry[A, B](fa: M[A])(f: (Try[A]) => B): M[B]

map over result of checked evaluation of A

map over result of checked evaluation of A

Attributes

Inherited from:
CpsTryMonad
def mapTryAsync[A, B](fa: M[A])(f: (Try[A]) => M[B]): M[B]

synonym for flatMapTry needed for processing awaits inside mapTry.

synonym for flatMapTry needed for processing awaits inside mapTry.

Attributes

Inherited from:
CpsTryMonad
def mplus[A](a: M[A], b: => M[A]): M[A]

mplus in haskell LogicT Synonym for 'orElse'.

mplus in haskell LogicT Synonym for 'orElse'.

Attributes

Inherited from:
CpsLogicMonad
def msplit[A](c: M[A]): M[Option[(Try[A], M[A])]]

Split computation into part, which return as first value and rest of computation and return this as logic stream.

Split computation into part, which return as first value and rest of computation and return this as logic stream.

Attributes

Inherited from:
CpsLogicMonad
def mzero[A]: M[A]

mzero in haskell LogicT Synonym for 'empty'.

mzero in haskell LogicT Synonym for 'empty'.

Attributes

Inherited from:
CpsLogicMonad
def once[A](a: M[A]): M[A]

get the first value of computation, discarding all other. head of the list, or soft cut in prolog (scoped inside current computation).

get the first value of computation, discarding all other. head of the list, or soft cut in prolog (scoped inside current computation).

Attributes

Inherited from:
CpsLogicMonad
def pure[T](t: T): M[T]

Pure - wrap value t inside monad.

Pure - wrap value t inside monad.

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

Attributes

Inherited from:
CpsMonad
def restore[A](fa: M[A])(fx: Throwable => M[A]): M[A]

restore fa, ie if fa sucessful - return fa, otherwise apply fx to received error.

restore fa, ie if fa sucessful - return fa, otherwise apply fx to received error.

Attributes

Inherited from:
CpsTryMonad
def seqOr[A](a: M[A], b: => M[A]): M[A]

Create a computation, which explore a and then b end do not start evaluation of b until all values or a are explored.

Create a computation, which explore a and then b end do not start evaluation of b until all values or a are explored.

Synonym for MonadPlus 'mplus' or Alternative '<|>' in haskell.

Attributes

Inherited from:
CpsLogicMonad
def tryImpure[A](a: => M[A]): M[A]

try to evaluate async operation and wrap successful or failed result into F.

try to evaluate async operation and wrap successful or failed result into F.

Attributes

Inherited from:
CpsTryMonad
def tryPure[A](a: => A): M[A]

try to evaluate synchonious operation and wrap successful or failed result into F.

try to evaluate synchonious operation and wrap successful or failed result into F.

Attributes

Inherited from:
CpsTryMonad
def tryPureAsync[A](a: () => M[A]): M[A]

async shift of tryPure.

async shift of tryPure.

Attributes

Inherited from:
CpsTryMonad
def unsplit[A](ta: Try[A], m: M[A]): M[A]

Attributes

Inherited from:
CpsLogicMonad
def withAction[A](fa: M[A])(action: => Unit): M[A]

ensure that action will run before getting value from fa

ensure that action will run before getting value from fa

Attributes

Inherited from:
CpsTryMonad
def withActionAsync[A](fa: M[A])(action: () => M[Unit]): M[A]

async shift of withAction.

async shift of withAction.

This method is substituted instead withAction, when we use await inside withAction argument.

Attributes

Inherited from:
CpsTryMonad
def withAsyncAction[A](fa: M[A])(action: => M[Unit]): M[A]

return result of fa after completition of action.

return result of fa after completition of action.

Attributes

Inherited from:
CpsTryMonad
def withAsyncErrorHandler[A](fa: => M[A])(f: Throwable => M[A]): M[A]

Attributes

Inherited from:
CpsTrySupport
def withAsyncFinalizer[A](fa: => M[A])(f: => M[Unit]): M[A]

Attributes

Inherited from:
CpsTrySupport
def wrap[T](op: => T): M[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

Inherited fields

instance of observer cps monad.

instance of observer cps monad.

Attributes

Inherited from:
CpsLogicMonad