jackfirth / pyramda

Python package supporting heavy functional programming through currying. Translation of the Ramda library from javascript to python.
MIT License
127 stars 10 forks source link

Add contract checking for functions passed as arguments to pyramda functions #27

Open skabbass1 opened 7 years ago

skabbass1 commented 7 years ago

Currently, there are no checks in place to ensure that functions passed as arguments to pyramda functions conform to a specific contract in terms of signature and return values. For example, the function passed to pyramda's flip function must accept atleast two arguments or the function passed to filter must be a predicate.

Libraries such as sanctuary might provide a good paradigm for implementing such contract checking

jackfirth commented 7 years ago

My experience with contracts mostly comes from the Racket programming language. The Racket Guide has a document describing contracts called Simple Contracts on Functions, which covers most of what we want. There's a few gotchas involved though:

We might have to roll our own library for this, I've not yet found a python contracts implementation that handles all of the above.

skabbass1 commented 7 years ago

This will be fun to work on!