[Haskell-cafe] how to reify an API?

Johannes Waldmann johannes.waldmann at htwk-leipzig.de
Thu Jun 2 21:00:29 UTC 2016


Dear Cafe,

I wanted to benchmark (part of) an API of a package,
by enumerating all possible (nested) calls by size of their AST,
much as smallcheck does it for  data.

So I made this straightforward AST representation
and (generically) got its Serial instances. That last part
has been in smallcheck for a long time, and works nicely.

But I do wonder if there is a way to get the AST
(and corresponding interpreter) with less boilerplate code (than this:
https://github.com/jwaldmann/pretty-test/blob/master/src/Lib.hs#L29 )

If you read the code: it also has a type for "AST contexts"
because I wanted to iterate them (to produce larger trees).
Again - easy to write down, but boring.

- J.


More information about the Haskell-Cafe mailing list