PolyReaderEffect

turbolift.effects.PolyReaderEffect
See thePolyReaderEffect companion object
abstract class PolyReaderEffect extends ReaderEffect Polymorphic_+ Any

Polymorphic variant of ReaderEffect.

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

// The `R` is explicitly set as `String`:
case object MyReader extends ReaderEffect[String]

// The `R` is inferred from the effect instance:
val computation = MyReader.ask

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

case object MyReader extends PolyReaderEffect

val computation1 = MyReader.ask[Int]              // `R` inferred as `Int`
val computation2 = MyReader.ask[String]           // `R` inferred as `String`
val computation3 = computation1 **! computation2  // `R` inferred as `Int & String`

// Inferred types of the above computations:
val _: Int           !! MyReader.@@[Int]          = computation1
val _: String        !! MyReader.@@[String]       = computation2
val _: (Int, String) !! MyReader.@@[Int & String] = computation3

Attributes

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

Members list

Type members

Classlikes

final class AsksApply[R]

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 AsksEffApply[R]

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 LocalModifyApply[R]

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 LocalModifyEffApply[R]

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 LocalPutApply[R]

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 LocalPutEffApply[R]

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 ask[R]: Computation[R, @@[R]]
final def asks[R]: AsksApply[R]
final def asksEff[R]: AsksEffApply[R]
def handler[R](initial: R): Handler[Identity, Identity, thiz.@@[R], Any]
Extension method from PolyReaderEffect

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 localModify[R]: LocalModifyApply[R]
final def localPut[R]: LocalPutApply[R]
final def localPutEff[R]: LocalPutEffApply[R]

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: ReaderEffect[Any]

Attributes

Inherited from:
Polymorphic_+