kadai
Represents the result of an action, which may be the result itself or an Invalid (error).
An unsafe operation may be attempted using Attempt.safe(unsafeCall) for instance:
Attempt.safe(unsafeCall)
val r: Attempt[String] = for { a <- Attempt.safe { throw new RuntimeException("oh noes!") } b <- Attempt.ok("should be ok!") } yield b
will result in an Attempt that holds an Invalid.Err with the RuntimeException in it.
This class does not – and will not – auto-magically catch exceptions for you in map/flatMap.
map
flatMap
1.2
Catamorphism.
Catamorphism. Run the first given function if left, otherwise, the second given function.
1.3
Represents the result of an action, which may be the result itself or an Invalid (error).
An unsafe operation may be attempted using
Attempt.safe(unsafeCall)
for instance:will result in an Attempt that holds an Invalid.Err with the RuntimeException in it.
This class does not – and will not – auto-magically catch exceptions for you in
map
/flatMap
.1.2