names-th- Manipulate name strings for TH

Copyright2013 Kei Hibino
Safe HaskellNone




This module provides extra helper functions complementing Language.Haskell.TH.Lib


Extra template functions

Extra functions to generate haskell templates.

integralE :: Integral a => a -> ExpQ Source #

Integer literal template from Integral types.

simpleValD :: Name -> TypeQ -> ExpQ -> Q [Dec] Source #

Generate declaration template from name, type and expression.

maybeD :: (a -> Q [Dec]) -> Maybe a -> Q [Dec] Source #

May generate declaration template.

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"

reportWarning :: String -> Q () Source #

Print compile warnings from TH code.

reportError :: String -> Q () Source #

Print compile errors from TH code.