Packages

p

fs2

util

package util

Type classes and other utilities used by fs2.

Type Classes

This package includes a minimal set of common functional type classes -- e.g., Functor, Applicative, Monad, Traverse -- along with some extensions that are more specialized like Suspendable, Catchable, Effect, and Async.

Infix syntax is provided for all of these type classes by the fs2.util.syntax object, which is used by adding import fs2.util.syntax._. The infix syntax has no runtime cost. The type classes generally do not define many derived methods (with the exception of Async). Instead, derived methods are defined soley infix. For example, Monad does not define flatten but monad infix syntax does.

Note that these type classes are intentionally minimal. Providing a general purpose set of functional structures is not a goal of FS2.

Source
util.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. util
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. trait Applicative [F[_]] extends Functor[F]

    Applicative type class.

    Applicative type class.

    For infix syntax, including derived methods like product, import fs2.util.syntax._.

    See also

    http://strictlypositive.org/IdiomLite.pdf

  2. trait Async [F[_]] extends Effect[F]

    Type class which describes effects that support asynchronous evaluation.

    Type class which describes effects that support asynchronous evaluation.

    Instances of this type class are defined by providing an implementation of ref, which allocates a mutable memory cell that supports various asynchronous operations.

    For infix syntax, import fs2.util.syntax._.

    Annotations
    @implicitNotFound( ... )
  3. type Attempt[+A] = Either[Throwable, A]

    Alias for Either[Throwable,A].

  4. trait Catchable [F[_]] extends Monad[F]

    Monad which tracks exceptions thrown during evaluation.

    Monad which tracks exceptions thrown during evaluation.

    For infix syntax, import fs2.util.syntax._.

  5. sealed abstract class Catenable [+A] extends AnyRef

    Trivial catenable sequence.

    Trivial catenable sequence. Supports O(1) append, and (amortized) O(1) uncons, such that walking the sequence via N successive uncons steps takes O(N). Like a difference list, conversion to a Stream[A] takes linear time, regardless of how the sequence is built up.

  6. trait Effect [F[_]] extends Catchable[F] with Suspendable[F]

    Monad which supports catching exceptions, suspending evaluation, and (potentially asynchronous) evaluation (i.e.

    Monad which supports catching exceptions, suspending evaluation, and (potentially asynchronous) evaluation (i.e. extraction of a value).

    For infix syntax, import fs2.util.syntax._.

  7. sealed trait Free [+F[_], +A] extends AnyRef

    A specialized free monad which captures exceptions thrown during evaluation.

  8. trait Functor [F[_]] extends AnyRef

    Functor type class.

    Functor type class.

    For infix syntax, including derived methods like as, import fs2.util.syntax._.

  9. sealed trait Lub1 [-F[_], -G[_], +Lub[_]] extends AnyRef

    Type operator that witnesses the least upper bound of type constructors F and G.

    Type operator that witnesses the least upper bound of type constructors F and G.

    Given a Lub1[F,G,Lub], forall x:

    • Lub[x] >: F[x]
    • Lub[x] >: G[x]
    • there is no L[x] for which L[x] >: F[x] and L[x] >: G[x] and L[x] <: Lub[x]
  10. trait Monad [F[_]] extends Applicative[F]

    Monad type class.

    Monad type class.

    For infix syntax, including derived methods like flatten, import fs2.util.syntax._.

  11. sealed trait RealSupertype [-Sub, Super] extends AnyRef

    Evidence that A <: B.

    Evidence that A <: B. This module provides implicit RealSupertype[Sub,Super] only if Super is not one of: Any, AnyVal, AnyRef, Product, or Serializable.

    Annotations
    @implicitNotFound( ... )
  12. trait RealType [T] extends AnyRef

    Evidence that T is not Any.

  13. sealed trait Sub1 [-F[_], +G[_]] extends AnyRef

    Evidence that forall x . F[x] <: G[x]

  14. trait Suspendable [F[_]] extends Monad[F]

    Monad which supports capturing a deferred evaluation of a by-name F[A].

    Monad which supports capturing a deferred evaluation of a by-name F[A].

    Evaluation is suspended until a value is extracted, typically via the unsafeRunAsync method on the related Effect type class or via a type constructor specific extraction method (e.g., unsafeRunSync on Task). Side-effects that occur while evaluating a suspension are evaluated exactly once at the time of extraction.

  15. trait Traverse [F[_]] extends Functor[F]

    Traverse type class.

    Traverse type class.

    For infix syntax, import fs2.util.syntax._.

    For parallel traverse and sequence, see the Async type class.

    See also

    http://strictlypositive.org/IdiomLite.pdf

  16. trait UF1 [-F[_], +G[_]] extends AnyRef

    A forall a . f a -> g a.

    A forall a . f a -> g a. Aliased as F ~> G.

  17. type ~>[-F[_], +G[_]] = UF1[F, G]

    Operator alias for UF1[F,G].

Value Members

  1. object Async
  2. object Attempt

    Provides constructors for the Attempt alias.

  3. object Catchable
  4. object Catenable
  5. object Free
  6. object Lub1 extends Lub1Instances1
  7. object NonFatal

    Alternative to scala.util.control.NonFatal that only considers VirtualMachineErrors as fatal.

  8. object RealSupertype extends NothingSubtypesItself
  9. object RealType extends RealTypeInstance
  10. object Sub1 extends Sub1Instances0
  11. object Traverse
  12. object UF1
  13. object syntax

    Provides infix syntax for the typeclasses in the util package.

Inherited from AnyRef

Inherited from Any

Ungrouped