[Haskell-cafe] is there a way to run tests at compile time using TH

Ian Lynagh igloo at earth.li
Sun Aug 26 09:16:25 EDT 2007


On Sun, Aug 26, 2007 at 01:20:52AM -0700, Alex Jacobson wrote:
> I'd like to have code not compile if it doesn't pass the tests.
> 
> Is there a way to use TH to generate compiler errors if the tests don't 
> pass?

This should do it, in a different module to that which defines runtests:

$( case runtests of
       Success -> return []
       Failure -> error "Tests failed"
 )


Thanks
Ian



More information about the Haskell-Cafe mailing list