vickumar1981 / pyeffects

Handle side-effects in Python like a boss. Implements functional types for Either, Option, Try, and Future.
Other
30 stars 6 forks source link

Compatibility with Type Hinting #12

Closed vickumar1981 closed 3 years ago

vickumar1981 commented 4 years ago

Using type hinting, you can't specify the type parameter to any of the classes.

i.e.:

def find_person(id: int) -> Option:
    # pass

will work, but

def find_person(id: int) -> Option[string]:
    # doesn't work, should

will not work.

Expected Result

Expect to be able to pass the type parameters via type hinting. Python's Iterable and List do this, for example.

Actual Result

An exception is thrown: 'type' object is not subscriptable

Reproduction Steps

import pyeffects.Option.*

def find_person(id: int) -> Option[string]:
  pass
vickumar1981 commented 3 years ago