26 Aug
                
                    2007
                
            
            
                26 Aug
                
                '07
                
            
            
            
        
    
                9:13 a.m.
            
        Alex Jacobson 
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?
What about something like this? import Language.Haskell.TH import Tests -- this should export "testsPass :: Bool" -- don't bother trying to call this function. check = $( if testsPass then [| () |] else error "test failed" ) main = print "hi" If testsPass returns False, the compiler will throw an exception during compilation, like this: Exception when trying to run compile-time code: test failed [...]