object FP
Various utilities for functional programming.
- Alphabetic
- By Inheritance
- FP
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def indexFound(w: String, i: Int): Try[Int]
Method to determine if the String w was found at a valid index (i).
Method to determine if the String w was found at a valid index (i).
- w
the String (ignored unless there's an exception).
- i
the index found.
- returns
Success(i) if all well, else Failure(exception).
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def partition[X](xys: Iterable[Try[X]]): (Iterable[Try[X]], Iterable[Try[X]])
Method to partition an method to combine elements of Try.
Method to partition an method to combine elements of Try.
- X
the underlying type.
- xys
a Seq of Try[X].
- returns
a tuple of two Seqs of Try[X], the first one being successes, the second one being failures.
- def partition[X](xys: Iterator[Try[X]]): (Iterator[Try[X]], Iterator[Try[X]])
Method to partition an Iterator.
Method to partition an Iterator.
- X
the underlying type.
- xys
an Iterator of Try[X].
- returns
a tuple of two iterators of Try[X], the first one being successes, the second one being failures.
- def recoverOption[X](xy: => Try[Option[X]])(f: (Throwable) => Unit): Option[X]
Attempts to recover the value from a computation represented as a lazy
Try[Option[X]].Attempts to recover the value from a computation represented as a lazy
Try[Option[X]]. If the computation succeeds, it returns the containedOption[X]. If the computation fails with a non-fatal exception, the exception is passed to the provided recovery function, and the result isNone. Fatal exceptions are rethrown.- X
The underlying type of the
Option.- xy
A lazy computation resulting in a
Try[Option[X]]. It is evaluated when the method is invoked.- f
A function to handle non-fatal exceptions encountered during evaluation of
xy.- returns
The
Option[X]value if successful,Noneif a non-fatal exception occurs, or the exception is rethrown if it is fatal.
- def resource[C](resourceName: String)(implicit arg0: ClassTag[C]): Try[URL]
Method to yield a URL for a given resourceForClass in the classpath for C.
Method to yield a URL for a given resourceForClass in the classpath for C.
- C
a class of the package containing the resourceForClass.
- resourceName
the name of the resourceForClass.
- returns
a
Try[URL].
- def resourceForClass(resourceName: String, clazz: Class[_] = getClass): Try[URL]
Method to yield a Try[URL] for a resource name and a given class.
Method to yield a Try[URL] for a resource name and a given class.
- resourceName
the name of the resource.
- clazz
the class, relative to which the resource can be found (defaults to the caller's class).
- returns
a Try[URL]
- def sampler[X](n: Int)(implicit r: Random): (X) => Boolean
Method to return a random sampling function.
Method to return a random sampling function.
- X
the underlying type of the sampler.
- n
this is the sample factor: approximately one in every n successful results will form part of the result.
- r
(implicit) Random source of entropy.
- returns
an
X => Booleanfunction which is always yields false if its input is a failure, otherwise, it chooses every nth value (approximately).
- def sequence[X](xos: Iterator[Option[X]]): Option[Seq[X]]
Sequence method to combine elements of Option[X].
Sequence method to combine elements of Option[X]. The result is defined unless all the elements are None.
NOTE that the order of the resulting values will be the reverse of the iterator. This is for performance reasons.
- X
the underlying type.
- xos
an Iterable of Option[X].
- returns
an Option of Seq[X]. NOTE: that the output collection type will be Seq, regardless of the input type
- def sequence[X](xos: Iterable[Option[X]]): Option[Seq[X]]
Sequence method to combine elements of type Option[X].
Sequence method to combine elements of type Option[X]. The result is not defined unless all/any? of the elements are defined.
NOTE that the order of the resulting values will be the reverse of the input. This is for performance reasons.
- X
the underlying type.
- xos
an Iterable of Option[X].
- returns
an Option of Seq[X]. NOTE: that the output collection type will be Seq, regardless of the input type CONSIDER using Builder
- def sequence[X](xys: Iterable[Try[X]]): Try[Seq[X]]
Sequence method to combine elements of Try while retaining their original order.
Sequence method to combine elements of Try while retaining their original order.
- X
the underlying type
- xys
an Iterable of Try[X]
- returns
a Try of Seq[X] NOTE: that the output collection type will be Seq, regardless of the input type
- def sequence[X](xys: Iterator[Try[X]]): Try[Iterator[X]]
Sequence method to combine elements of Try.
Sequence method to combine elements of Try.
CONSIDER invoking sequenceRev
- X
the underlying type
- xys
an Iterator of Try[X]
- returns
a Try of Iterator[X]
- def sequenceForgiving[X](xys: Iterable[Try[X]]): Try[Seq[X]]
Sequence method to combine elements of Try.
Sequence method to combine elements of Try.
- X
the underlying type.
- xys
an Iterable of Try[X].
- returns
a Try of Seq[X]. NOTE: that the output collection type will be Seq, regardless of the input type
- def sequenceForgivingTransform[X](xys: Iterable[Try[X]])(fSuccess: (X) => Try[Option[X]], pfFailure: PartialFunction[Throwable, Try[Option[X]]]): Try[Seq[X]]
Sequence method to combine elements of Try.
Sequence method to combine elements of Try.
- X
the underlying type.
- xys
an Iterable of Try[X].
- fSuccess
a function of type X => Try of Option[X].
- pfFailure
a partial function of type Throwable => Try of Option[X].
- returns
a Try of Seq[X]. NOTE: that the output collection type will be Seq, regardless of the input type
- def sequenceForgivingWith[X](xys: Iterable[Try[X]])(pfFailure: PartialFunction[Throwable, Try[Option[X]]]): Try[Seq[X]]
Sequence method to combine elements of Try.
Sequence method to combine elements of Try.
- X
the underlying type.
- xys
an Iterable of Try[X].
- pfFailure
a partial function of type Throwable => Try of Option[X].
- returns
a Try of Seq[X]. NOTE: that the output collection type will be Seq, regardless of the input type
- def sequenceInc[X](xos: Iterable[Option[X]]): Option[Seq[X]]
Sequence (inclusive) method to combine elements of type Option[X].
Sequence (inclusive) method to combine elements of type Option[X]. The result is defined unless all the elements are None.
NOTE that the order of the resulting values will be the reverse of the input. This is for performance reasons.
- X
the underlying type.
- xos
an Iterable of Option[X].
- returns
an Option of Seq[X]. NOTE: that the output collection type will be Seq, regardless of the input type
- def sequenceRev[X](xys: Iterable[Try[X]]): Try[Seq[X]]
Sequence method to combine elements of Try.
Sequence method to combine elements of Try.
NOTE: this method is much faster than sequence but does return the elements in their reverse order.
- X
the underlying type
- xys
an Iterable of Try[X]
- returns
a Try of Seq[X] NOTE: that the output collection type will be Seq, regardless of the input type
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def tryToOption[X](f: (Throwable) => Unit)(xy: Try[X]): Option[X]
Method to transform a Try[X] into an Option[X].
Method to transform a Try[X] into an Option[X]. But, unlike "toOption," a Failure can be logged.
- X
the underlying type.
- f
a function to process any Exception (typically a logging function).
- xy
the input Try[X].
- returns
an Option[X].
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)