suned / pfun

Functional, composable, asynchronous, type-safe Python.
https://pfun.dev/
MIT License
151 stars 14 forks source link

Add curried overload to Curry.__call__ type #80

Closed suned closed 3 years ago

suned commented 3 years ago

The current implementation of the type analyzer for Curry types and curry calls only adds the uncurried function type as the type of __call__. This means that the following call produces a false negative:

f: Curry[Callable[[int, int], int]]
g: Callable[[Callable[[int], Callable[[int], int]]], int]

g(f)

As a first solution I suggest to add an overloaded signature to Curry.__call__ that is curried in the required arguments only