[Haskell-cafe] What is the state of the art in testing code generation?

Tom Ellis tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Mon Jul 14 13:20:08 UTC 2014


On Sat, Jul 12, 2014 at 11:08:51AM +0300, Jake Wheat wrote:
> > Is this the best we can do in Haskell?  Certainly it seems hard to use a
> > QuickCheck/SmallCheck approach for this purpose.  Is there any way this
> > kind of testing can be automated or made more robust?
> 
> You could make a simple AST which can be used to generate SQL query
> text directly, and also the Haskell source code for your DSL. Then you
> can compare the results of the two code paths 'AST -> concrete SQL'
> and 'AST -> generate Haskell -> run the Haskell -> concrete SQL'. If
> you can get this working then this could make it easier to use
> Quickcheck, etc..

Thanks Jake that's an interesting idea, though I fear that any AST powerful
enough to compile to both SQL and my EDSL would be no less complicated than
my DSL in the first place.

Tom


More information about the Haskell-Cafe mailing list