I'm new to Template Haskell and just started playing with it. I have Haskell platform 2011.4.0 and I get this error when I try to run this simple code.
main = do code <- runQ $ recover (return []) th putStrLn (pprint code) putStrLn (show code) th :: Q [Dec] th = [d| sum a b = a + b |] Template Haskell error: Can't do `recover' in the IO monad POC.hs: user error (Template Haskell failure) How can I get declarations with the "recover" function so I can print a custom error message using "location"? If I can't do it inside the IO monad, how can I do a program to pretty print Haskell code? Thanks! _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe