You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In monadic[F] { ... }, if each is applied to a monad of type F[Nothing], a compilation error "Macro has not been expanded" occurs.
F[Nothing] is a natural type for a fail operation (e.g., Nil, None) in a monad, since the return value can be upcast to anything (e.g., val x = if (x >= 0) sqrt(x) else None.each would be a use case).
Example code:
object MonadicNeedsCast {
def main(args: Array[String]): Unit = {
val monad = monadic[Option] {
None.each // Normally, this would be inside an if and represent a failure of the computation
// (None:Option[Unit]).each // This one works
55
}
println(monad) // Should be None
}
}
The error also appears with monadic[List] or with custom monads. It also appears when using fail.each where fail has type [T]fail( => T).
I am using Scala 2.11.8 and Each 2.0.0.
The text was updated successfully, but these errors were encountered:
In
monadic[F] { ... }
, ifeach
is applied to a monad of typeF[Nothing]
, a compilation error "Macro has not been expanded" occurs.F[Nothing]
is a natural type for a fail operation (e.g.,Nil
,None
) in a monad, since the return value can be upcast to anything (e.g.,val x = if (x >= 0) sqrt(x) else None.each
would be a use case).Example code:
The error also appears with
monadic[List]
or with custom monads. It also appears when usingfail.each
where fail has type[T]fail( => T)
.I am using Scala 2.11.8 and Each 2.0.0.
The text was updated successfully, but these errors were encountered: