PolyWriterEffect

turbolift.effects.PolyWriterEffect
See thePolyWriterEffect companion object
abstract class PolyWriterEffect extends WriterEffect Polymorphic_- Any

Polymorphic variant of WriterEffect.

In the monomorphic variant, the W type parameter is supplied during creation of an instance of the effect:

// The `W` is explicitly set as `Int`:
case object MyWriter extends WriterEffect[Int]

// The `W` is inferred from the effect instance:
val computation = MyWriter.tell(42)

In the polymorphic variant, the W type parameter is contravariantly inferred at call sites of effect's operations and handlers. In practice, the type can "grow as you go":

case object MyWriter extends PolyWriterEffect

val computation1 = MyWriter.tell(42)              // `W` inferred as `Int`
val computation2 = MyWriter.tell("OMG")           // `W` inferred as `String`
val computation3 = computation1 &&! computation2  // `W` inferred as `Int | String`

// Inferred types of the above computations:
val _: Unit !! MyWriter.@@[Int]          = computation1
val _: Unit !! MyWriter.@@[String]       = computation2
val _: Unit !! MyWriter.@@[Int | String] = computation3

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Writer

Members list

Type members

Classlikes

final class CensorApply[W]

Helper class for partial type application. Won't be needed in future Scala (SIP-47).

Helper class for partial type application. Won't be needed in future Scala (SIP-47).

Attributes

Supertypes
class Object
trait Matchable
class Any
final class ListenApply[W]

Helper class for partial type application. Won't be needed in future Scala (SIP-47).

Helper class for partial type application. Won't be needed in future Scala (SIP-47).

Attributes

Supertypes
class Object
trait Matchable
class Any
final class MuteApply[W]

Helper class for partial type application. Won't be needed in future Scala (SIP-47).

Helper class for partial type application. Won't be needed in future Scala (SIP-47).

Attributes

Supertypes
class Object
trait Matchable
class Any
final class PassApply[W]

Helper class for partial type application. Won't be needed in future Scala (SIP-47).

Helper class for partial type application. Won't be needed in future Scala (SIP-47).

Attributes

Supertypes
class Object
trait Matchable
class Any
object handlers

Predefined handlers for this effect.

Predefined handlers for this effect.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
handlers.type

Inherited classlikes

final class Polymorphize[X]

Helper class for partial type application. Won't be needed in future Scala (SIP-47).

Helper class for partial type application. Won't be needed in future Scala (SIP-47).

Attributes

Inherited from:
Polymorphic_-
Supertypes
class Object
trait Matchable
class Any

Inherited and Abstract types

type @@[-X]

Read as Apply

Read as Apply

This effect, but with given type parameter applied.

Attributes

Inherited from:
Polymorphic_-

Value members

Concrete methods

final def censor[W]: CensorApply[W]
def handler[W](using W: PlusZero[W]): Handler[Identity, Tuple2, thiz.@@[W], Any]
Extension method from PolyWriterEffect

Alias of the default handler for this effect.

Alias of the default handler for this effect.

Defined as an extension, to allow custom redefinitions without restrictions imposed by overriding

Attributes

final def listen[W]: ListenApply[W]
final def mute[W]: MuteApply[W]
final def pass[W]: PassApply[W]
final def tell[W](w: W): Computation[Unit, @@[W]]

Inherited methods

inline def polymorphize[X]: Polymorphize[X]

API for defining custom effects.

API for defining custom effects.

Attributes

Inherited from:
Polymorphic_-

Inherited fields

protected val monomorphic: WriterEffect[Any]

Attributes

Inherited from:
Polymorphic_-