-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Utility functions for testing Template Haskell code -- -- Utility functions for testing Template Haskell code, including -- functions for testing failures in the Q monad. @package th-test-utils @version 1.0.0 -- | This module defines utilites for testing Template Haskell code. module Language.Haskell.TH.TestUtils -- | Run the given Template Haskell computation, returning either an error -- message or the final result. tryQ' :: Q a -> Q (Either String a) -- | Run the given Template Haskell computation, returning a splicable -- expression that resolves to Left the error message or -- Right the final result. -- --
-- -- Left "This splice fails" -- $(tryQ spliceFail) :: Either String Int -- -- -- Right 1 -- $(tryQ spliceInt) :: Either String Int --tryQ :: Q Exp -> Q Exp -- | tryQ, except returns Just the error message or -- Nothing if the computation succeeded. -- --
-- -- Just "This splice fails" -- $(tryQErr spliceFail) :: Maybe String -- -- -- Nothing -- $(tryQErr spliceInt) :: Maybe String --tryQErr :: Q a -> Q Exp -- | tryQ, except returns the error message or fails if the -- computation succeeded. -- --
-- -- "This splice fails" -- $(tryQErr' spliceFail) :: String -- -- -- compile time error: "Q monad unexpectedly succeeded" -- $(tryQErr' spliceInt) :: String --tryQErr' :: Q a -> Q Exp instance Control.Monad.IO.Class.MonadIO Language.Haskell.TH.TestUtils.TryQ instance GHC.Base.Monad Language.Haskell.TH.TestUtils.TryQ instance GHC.Base.Applicative Language.Haskell.TH.TestUtils.TryQ instance GHC.Base.Functor Language.Haskell.TH.TestUtils.TryQ instance Control.Monad.Fail.MonadFail Language.Haskell.TH.TestUtils.TryQ instance Language.Haskell.TH.Syntax.Quasi Language.Haskell.TH.TestUtils.TryQ