Closed yurigba closed 1 year ago
The Python version is 3.10.6
Hi, thanks for flagging this issue. The correct code should be:
from expression import effect, Option, Some, Nothing
def divide(a: float, divisor: float) -> Option[float]:
try:
return Some(a / divisor)
except ZeroDivisionError:
return Nothing
@effect.option[float]()
def comp(x: float):
result: float = yield from divide(42, x)
result += 32
print(f"The result is {result}")
return result
comp(42)
It worked. Thank you.
I am trying to reproduce the following code block from this tutorial:
It returns the following on jupyter lab:
I couldn't make this code to work. Any suggestions?