Applicative type class.
Applicative type class.
For infix syntax, including derived methods like product
, import fs2.util.syntax._
.
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._
.
Alias for Either[Throwable,A]
.
Monad which tracks exceptions thrown during evaluation.
Monad which tracks exceptions thrown during evaluation.
For infix syntax, import fs2.util.syntax._
.
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 Seq[A]
takes linear time, regardless of how the sequence is built up.
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._
.
A specialized free monad which captures exceptions thrown during evaluation.
Functor type class.
Functor type class.
For infix syntax, including derived methods like as
, import fs2.util.syntax._
.
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]
L[x]
for which L[x] >: F[x]
and L[x] >: G[x]
and L[x] <: Lub[x]
Monad type class.
Monad type class.
For infix syntax, including derived methods like flatten
, import fs2.util.syntax._
.
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
.
Evidence that T
is not Any
.
Evidence that forall x . F[x] <: G[x]
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.
Traverse type class.
Traverse type class.
For infix syntax, import fs2.util.syntax._
.
For parallel traverse and sequence, see the Async type class.
A forall a . f a -> g a
.
A forall a . f a -> g a
. Aliased as F ~> G
.
Operator alias for UF1[F,G]
.
Provides constructors for the Attempt
alias.
Alternative to scala.util.control.NonFatal
that only considers VirtualMachineError
s as fatal.
Provides infix syntax for the typeclasses in the util package.
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 ofAsync
). Instead, derived methods are defined soley infix. For example,Monad
does not defineflatten
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.