Syntax2

izumi.functional.bio.syntax.Syntax2
See theSyntax2 companion object
trait Syntax2 extends ImplicitPuns

All implicit syntax in BIO is available automatically without wildcard imports with the help of so-called "implicit punning", as in the following example:

 import izumi.functional.bio.Monad2

 def loop[F[+_, +_]: Monad2]: F[Nothing, Nothing] = {
   val unitEffect: F[Nothing, Unit] = Monad2[F].unit
   unitEffect.flatMap(loop)
 }

Note that a .flatMap method is available on the unitEffect value of an abstract type parameter F, even though we did not import any syntax implicits using a wildcard import.

The flatMap method was added by the implicit punning on the Monad2 name. In short, implicit punning just means that instead of creating a companion object for a type with the same name as the type, we create "companion" implicit conversions with the same name. So that whenever you import the type, you are also always importing the syntax-providing implicit conversions.

This happens to be a great fit for Tagless Final Style, since nearly all TF code will import the names of the used typeclasses.

Implicit Punning for typeclass syntax relieves the programmer from having to manually import syntax implicits in every file in their codebase.

Attributes

Note

The order of conversions is such to allow otherwise conflicting type classes to not conflict, e.g. code using constraints such as def x[F[+_, +_]: Functor2: Applicative2: Monad2] will compile and run normally when using syntax, despite ambiguity of implicits caused by all 3 implicits inheriting from Functor2. This is because, due to the priority order being from most-specific to least-specific, the Monad2 syntax will be used in such a case, where the Monad2[F] implicit is actually unambiguous.

Companion
object
Graph
Supertypes

Members list

Value members

Concrete methods

def F[F[_, _]](implicit F: Functor2[F]): F.type

A convenient dependent-typed summoner for BIO hierarchy. Auto-narrows to the most powerful available type class:

A convenient dependent-typed summoner for BIO hierarchy. Auto-narrows to the most powerful available type class:

 import izumi.functional.bio.{F, Temporal2}

 def y[F[+_, +_]: Temporal2] = {
   F.timeout(5.seconds)(F.forever(F.unit))
 }

Attributes

Inherited methods

final def Applicative2[F[_, _] : Applicative2]: Applicative2[F]

Attributes

Inherited from:
ImplicitPunsApplicative

Attributes

Inherited from:
ImplicitPunsApplicativeError
final def Async2[F[_, _] : Async2]: Async2[F]

Attributes

Inherited from:
ImplicitPunsAsync
final def Bifunctor2[F[_, _] : Bifunctor2]: Bifunctor2[F]

Attributes

Inherited from:
ImplicitPunsBifunctor
final def Bracket2[F[_, _] : Bracket2]: Bracket2[F]

Attributes

Inherited from:
ImplicitPunsBracket
final def Concurrent2[F[_, _] : Concurrent2]: Concurrent2[F]

Attributes

Inherited from:
ImplicitPunsConcurrent
final def Error2[F[_, _] : Error2]: Error2[F]

Attributes

Inherited from:
ImplicitPunsError
final def Fork2[F[_, _] : Fork2]: Fork2[F]

Attributes

Inherited from:
ImplicitPunsFork
final def Functor2[F[_, _] : Functor2]: Functor2[F]

Attributes

Inherited from:
ImplicitPunsFunctor
final def Guarantee2[F[_, _] : Guarantee2]: Guarantee2[F]

Attributes

Inherited from:
ImplicitPunsGuarantee
final def IO2[F[_, _] : IO2]: IO2[F]

Attributes

Inherited from:
ImplicitPunsIO
final def IO2[F[_, _], A](effect: => A)(implicit F: IO2[F]): F[Throwable, A]

Shorthand for IO2#syncThrowable

Shorthand for IO2#syncThrowable

 IO2(println("Hello world!"))

Attributes

Inherited from:
ImplicitPunsIO
final def Monad2[F[_, _] : Monad2]: Monad2[F]

Attributes

Inherited from:
ImplicitPunsMonad
final def Panic2[F[_, _] : Panic2]: Panic2[F]

Attributes

Inherited from:
ImplicitPunsPanic
final def Parallel2[F[_, _] : Parallel2]: Parallel2[F]

Attributes

Inherited from:
ImplicitPunsParallel
final def Temporal2[F[_, _] : Temporal2]: Temporal2[F]

Attributes

Inherited from:
ImplicitPunsTemporal
final def WeakAsync2[F[_, _] : WeakAsync2]: WeakAsync2[F]

Attributes

Inherited from:
ImplicitPunsWeakAsync
final def WeakTemporal2[F[_, _] : WeakTemporal2]: WeakTemporal2[F]

Attributes

Inherited from:
ImplicitPunsWeakTemporal

Implicits

Inherited implicits

final implicit def Applicative2[F[_, _] : Applicative2, E, A](self: F[E, A]): ApplicativeOps[F, E, A]

Attributes

Inherited from:
ImplicitPunsApplicative
final implicit def ApplicativeError2[F[_, _] : ApplicativeError2, E, A](self: F[E, A]): ApplicativeErrorOps[F, E, A]

Attributes

Inherited from:
ImplicitPunsApplicativeError
final implicit def Async2[F[_, _] : Async2, E, A](self: F[E, A]): AsyncOps[F, E, A]

Attributes

Inherited from:
ImplicitPunsAsync
final implicit def Bifunctor2[F[_, _] : Functor2, E, A](self: F[E, A]): FunctorOps[F, E, A]

Attributes

Inherited from:
ImplicitPunsBifunctor
final implicit def Bifunctor2[F[_, _] : Bifunctor2, E, A](self: F[E, A]): BifunctorOps[F, E, A]

Attributes

Inherited from:
ImplicitPunsBifunctor
final implicit def Bracket2[F[_, _] : Bracket2, E, A](self: F[E, A]): BracketOps[F, E, A]

Attributes

Inherited from:
ImplicitPunsBracket
final implicit def Concurrent2[F[_, _] : Panic2, E, A](self: F[E, A]): PanicOps[F, E, A]

Attributes

Inherited from:
ImplicitPunsConcurrent
final implicit def Concurrent2[F[_, _] : Concurrent2, E, A](self: F[E, A]): ConcurrentOps[F, E, A]

Attributes

Inherited from:
ImplicitPunsConcurrent
final implicit def Error2[F[_, _] : Error2, E, A](self: F[E, A]): ErrorOps[F, E, A]

Attributes

Inherited from:
ImplicitPunsError
final implicit def Fork2[F[_, _] : Fork2, E, A](self: F[E, A]): ForkOps[F, E, A]

Attributes

Inherited from:
ImplicitPunsFork
final implicit def Functor2[F[_, _] : Functor2, E, A](self: F[E, A]): FunctorOps[F, E, A]

Attributes

Inherited from:
ImplicitPunsFunctor
final implicit def Guarantee2[F[_, _] : Guarantee2, E, A](self: F[E, A]): GuaranteeOps[F, E, A]

Attributes

Inherited from:
ImplicitPunsGuarantee
final implicit def IO2[F[_, _] : IO2, E, A](self: F[E, A]): IOOps[F, E, A]

Attributes

Inherited from:
ImplicitPunsIO
final implicit def Monad2[F[_, _] : Monad2, E, A](self: F[E, A]): MonadOps[F, E, A]

Attributes

Inherited from:
ImplicitPunsMonad
final implicit def Panic2[F[_, _] : Panic2, E, A](self: F[E, A]): PanicOps[F, E, A]

Attributes

Inherited from:
ImplicitPunsPanic
final implicit def Parallel2[F[_, _] : Monad2, E, A](self: F[E, A]): MonadOps[F, E, A]

Attributes

Inherited from:
ImplicitPunsParallel
final implicit def Parallel2[F[_, _] : Parallel2, E, A](self: F[E, A]): ParallelOps[F, E, A]

Attributes

Inherited from:
ImplicitPunsParallel
final implicit def ParallelErrorAccumulatingOps2[F[_, _] : Monad2, E, A](self: F[E, A]): MonadOps[F, E, A]

Attributes

Inherited from:
ImplicitPunsParallelErrorAccumulatingOps
final implicit def ParallelErrorAccumulatingOps2[F[_, _] : ParallelErrorAccumulatingOps2, E, A](self: F[E, A]): ParallelOps[F, E, A]

Attributes

Inherited from:
ImplicitPunsParallelErrorAccumulatingOps
final implicit def Temporal2[F[_, _] : Error2, E, A](self: F[E, A]): ErrorOps[F, E, A]

Attributes

Inherited from:
ImplicitPunsTemporal
final implicit def Temporal2[F[_, _] : Temporal2, E, A](self: F[E, A]): TemporalOps[F, E, A]

Attributes

Inherited from:
ImplicitPunsTemporal
final implicit def WeakAsync2[F[_, _] : WeakAsync2, E, A](self: F[E, A]): WeakAsyncOps[F, E, A]

Attributes

Inherited from:
ImplicitPunsWeakAsync
final implicit def WeakTemporal2[F[_, _] : Error2, E, A](self: F[E, A]): ErrorOps[F, E, A]

Attributes

Inherited from:
ImplicitPunsWeakTemporal
final implicit def WeakTemporal2[F[_, _] : WeakTemporal2, E, A](self: F[E, A]): WeakTemporalOps[F, E, A]

Attributes

Inherited from:
ImplicitPunsWeakTemporal