tweag / pirouette

Language-generic workbench for building static analysis
MIT License
47 stars 2 forks source link

Add a standard library for the example language #168

Closed Niols closed 1 year ago

Niols commented 1 year ago

This PR adds a tiny standard library for the example language. This allows shortening slightly the current tests. More importantly, it will help maximise sharing of usual functions in other tests, and I am planning to write quite a few of those in the future.

Technically, the example language does not support any notion of imports. Since the code of the tests would use those standard functions without defining them itself, the type checker would reject those pieces of code because they use undefined functions. One solution is to use the quasi-quoter progNoTC (read “program with no type-checking”), then to merge the resulting unchecked definitions with the ones from the standard library, and then only to call the type-checker. I attempted to make this slightly easier by providing a quasi-quoter progWithStdLib which basically does this under the hood. I don't know if that's the best design so I'm very open to remarks/suggestions.

Things that aren't that great yet:

What do you guys think?