| Copyright | 2013 Kei Hibino |
|---|---|
| License | BSD3 |
| Maintainer | ex8k.hibino@gmail.com |
| Stability | experimental |
| Portability | unknown |
| Safe Haskell | None |
| Language | Haskell2010 |
Language.Haskell.TH.Lib.Extra
Contents
Description
This module provides extra helper functions complementing Language.Haskell.TH.Lib
Extra template functions
Extra functions to generate haskell templates.
simpleValD :: Name -> TypeQ -> ExpQ -> Q [Dec] Source
Generate declaration template from name, type and expression.
Pretty printing for Q monad
Pretty printing for haskell templates.
pprQ :: (Functor m, Quasi m, Ppr a) => Q a -> m Doc Source
Helper function for pretty printing Q Monad.
Functions to print message or errors when compile time
Functions to display or to raise compile messages from codes which generating haskell templates.
Only messages directly generated by Q monad report actions
are handled by ghc loggers.
-- Handled by ghc logger qReport False "Foo"
-- Not handled by ghc logger runIO . runQ $ qReport False "Foo"
reportMessage :: Quasi m => String -> m () Source
Print compile message from TH code.
Only display when TH_EXTRA_MESSAGE_OUTPUT environment variable is set.
When variable value string is as_warn or as_warning and
using Q monad action, Output is put into ghc logger as warning.
Other cases are normal standard error output.
reportWarning :: String -> Q () Source
Print compile warnings from TH code.
reportError :: String -> Q () Source
Print compile errors from TH code.