Polymorphic variant of StateEffect.
In the monomorphic variant, the S
type parameter is supplied during creation of an instance of the effect:
// The `S` is explicitly set as `Int`:
case object MyState extends StateEffect[Int]
// The `S` is inferred from the effect instance:
val computation = MyState.get
In the polymorphic variant, the S
type parameter is invariantly inferred at call sites of effect's operations and handlers:
case object MyState extends PolyStateEffect
val computation1 = MyState.put(42) // `S` inferred as `Int`
val computation2 = MyState.get[Int] // `S` inferred as `Int`
val computation3 = MyState.get[String] // `S` inferred as `String`
// Inferred types of the above computations:
val _: Unit !! MyState.@@[Int] = computation1
val _: Unit !! MyState.@@[Int] = computation2
val _: Unit !! MyState.@@[String] = computation3
// Type error!
// Since `S` is invariant, compiler can't unify `S` as `Int` with `S` as `String`
val computation4 = computation2 &&! computation3
User must ensure that S
is inferred as the same type at all call sites, within the scope delimited by this effect's handler. Otherwise, application of the handler will fail to typecheck.
Attributes
Members list
Type members
Classlikes
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 Objecttrait Matchableclass Any
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 Objecttrait Matchableclass Any
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 Objecttrait Matchableclass Any
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 Objecttrait Matchableclass Any
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 Objecttrait Matchableclass Any
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 Objecttrait Matchableclass Any
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 Objecttrait Matchableclass Any
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 Objecttrait Matchableclass Any
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 Objecttrait Matchableclass Any
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 Objecttrait Matchableclass Any
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 Objecttrait Matchableclass Any
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 Objecttrait Matchableclass Any
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 Objecttrait Matchableclass Any
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 Objecttrait Matchableclass Any
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 Objecttrait Matchableclass Any
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 Objecttrait Matchableclass Any
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 Objecttrait Matchableclass Any
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 Objecttrait Matchableclass Any
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 Objecttrait Matchableclass Any
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 Objecttrait Matchableclass Any
Inherited classlikes
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 Objecttrait Matchableclass Any
Inherited and Abstract types
Read as Apply
Read as Apply
This effect, but with given type parameter applied.
Attributes
- Inherited from:
- Polymorphic_=
Value members
Concrete methods
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
Inherited methods
API for defining custom effects.
Inherited fields
Attributes
- Inherited from:
- Polymorphic_=