MVar

object MVar
Companion
class
class Object
trait Matchable
class Any

Type members

Classlikes

final class ApplyBuilders[F[_]](val F: OrElse[Concurrent[F], Async[F]]) extends AnyVal

Returned by the apply builder.

Returned by the apply builder.

Value members

Concrete methods

def apply[F[_]](F: OrElse[Concurrent[F], Async[F]]): ApplyBuilders[F]

Builds an MVar value for F data types that are either Concurrent or Async.

Builds an MVar value for F data types that are either Concurrent or Async.

Due to Concurrent's capabilities, the yielded values by MVar.take and MVar.put are cancelable. For Async however this isn't guaranteed, although the implementation does rely on bracket, so it might be.

This builder uses the Partially-Applied Type technique.

For creating an empty MVar:

MVar[IO].empty[Int]() <-> MVar.empty[IO, Int]()

For creating an MVar with an initial value:

MVar[IO].of("hello") <-> MVar.of[IO, String]("hello")

See also

of and empty

def empty[F[_], A](ps: PaddingStrategy)(F: OrElse[Concurrent[F], Async[F]], cs: ContextShift[F]): F[MVar[F, A]]

Builds an empty MVar instance.

Builds an empty MVar instance.

def of[F[_], A](initial: A, ps: PaddingStrategy)(F: OrElse[Concurrent[F], Async[F]], cs: ContextShift[F]): F[MVar[F, A]]

Builds an MVar instance with an initial value.

Builds an MVar instance with an initial value.