top | item 39441181

(no title)

davidfstr | 2 years ago

Looks like this library is serious. Most of what I see can be written more succinctly using existing Python functionality:

  1. Maybe -> Optional[T]
  2. Result -> Union[SuccessT, FailureT]
  3. Future, FutureResult -> concurrent.futures.Future[T]
  4. IO ->  don't use this; none of the standard library I/O supports it
I do appreciate the use of "container" as a term instead of "monad".

I also appreciate the typechecker enhancements being put forward by their custom plugins.

discuss

order

emblaegh|2 years ago

None of these has the functionality that the library offers, i.e. providing an interface to compose functions that consume and produce these types.

BerislavLopac|2 years ago

I believe the recent idiomatic recommendation for the first two is to use the union type expression:

  1. T | None
  2. SuccessT | FailureT

epgui|2 years ago

This is potentially quite helpful, but would you happen to have a source for that?