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
Hi, this is super interesting!
Since reflect returns back to the appropriate reify block, do you think it would be possible to express applicative effects?
My scala is pretty bad, but the goal would be to run all validations instead of short circuiting the computation.
def gtThanZero[A](field : String)(using r: Reflect[Validation]): A =
r.reflect(new Error("${field} must be > 0"))
def validate(x: Int, y: Int)(using Reflect[Validation]): () =
if (x <= 0) gtThanZero("x")
if (y <= 0) gtThanZero("y")
reify[Validation, ())] {
validate(0,0)
}
-- Would like to get something like [Error "x must be > 0", Error "y must be > 0"]
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, this is super interesting!
Since
reflect
returns back to the appropriatereify
block, do you think it would be possible to express applicative effects?My scala is pretty bad, but the goal would be to run all validations instead of short circuiting the computation.
Beta Was this translation helpful? Give feedback.
All reactions