Open sobolevn opened 4 years ago
We need this to wrap regular values into a monad. This might be required when you have a function like this:
@kinded def do_something(c: KindN[V, E, D], f: Callable[[V], N]) -> KindN[N, E, D]: ...
And you want to call it with just a plain value, like 1. Then, you wrap it into Identity(1) and pass into do_something with no problems.
1
Identity(1)
do_something
Maybe does not fit for several reasons:
Maybe
rescue
None
Identity(None)
On the other hand, it would be very strange thing to have. Maybe we can leave that for the end user?
Use Success
Success
https://habr.com/ru/post/429104/
https://twitter.com/Oli_kitty/status/1293722185958227968
We need this to wrap regular values into a monad. This might be required when you have a function like this:
And you want to call it with just a plain value, like
1
. Then, you wrap it intoIdentity(1)
and pass intodo_something
with no problems.Maybe
does not fit for several reasons:rescue
None
differently, we should be able to wrapIdentity(None)
as is