Re: [Haskell-cafe] Errors with Template Haskell

2013-08-09 Thread Jose A. Lopes
Thank you! -- Jose Antonio Lopes Ganeti Engineering Google Germany GmbH Dienerstr. 12, 80331, München Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Geschäftsführer: Graham Law, Christine Elizabeth Flores Steuernummer: 48/725/00206 Umsatzsteueridentifikationsnumme

Re: [Haskell-cafe] Errors with Template Haskell

2013-08-09 Thread Edsko de Vries
The Template Haskell quotation monad (Q) has proper support for fail: module A where import Language.Haskell.TH foo :: Q Exp foo = fail "Custom compile error!" and module B where import A main :: IO () main = print $foo gives B.hs:6:14: Custom co

[Haskell-cafe] Errors with Template Haskell

2013-08-09 Thread Jose A. Lopes
Hi, In Template Haskell, what is the proper way of signalling an error ? For example, you are generating code and you detect that a given parameter does not fulfill a precondition (e.g., String is empty), and you want to abort compilation with a descriptive error message. Thanks, Jose -- Jose