Polymorphic variant of ErrorEffect.
In the monomorphic variant, the E
type parameter is supplied during creation of an instance of the effect:
// The `E` is explicitly set as `String`:
case object MyError extends ErrorEffect[String]
// The `E` is inferred from the effect instance:
val computation = Myerror.raise("OMG")
In the polymorphic variant, the E
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 MyError extends PolyErrorEffect
val computation1 = MyError.raise(42) // `E` inferred as `Int`
val computation2 = MyError.raise("OMG") // `E` inferred as `String`
val computation3 = computation1 &&! computation2 // `E` inferred as `Int | String`
// Inferred types of the above computations:
val _: Nothing !! MyError.@@[Int] = computation1
val _: Nothing !! MyError.@@[String] = computation2
val _: Nothing !! MyError.@@[Int | String] = computation3
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
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_-