-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | A grab bag of functions for use with Template Haskell
--   
--   A grab bag of functions for use with Template Haskell.
--   
--   This is basically the place I put all my ugly CPP hacks to support the
--   ever-changing interface of the template haskell system by providing
--   high-level operations and making sure they work on as many versions of
--   Template Haskell as I can.
@package th-extras
@version 0.0.0.8

module Language.Haskell.TH.Extras
intIs64 :: Bool
replace :: (a -> Maybe a) -> a -> a
composeExprs :: [ExpQ] -> ExpQ

-- | Determines the name of a data constructor. It's an error if the
--   <a>Con</a> binds more than one name (which happens in the case where
--   you use GADT syntax, and give multiple data constructor names
--   separated by commas in a type signature in the where clause).
nameOfCon :: Con -> Name

-- | WARNING: discards binders in GADTs and existentially-quantified
--   constructors
argTypesOfCon :: Con -> [Type]
nameOfBinder :: TyVarBndr_ a -> Name
varsBoundInCon :: Con -> [TyVarBndrSpec]
namesBoundInPat :: Pat -> [Name]
namesBoundInDec :: Dec -> [Name]
genericalizeName :: Name -> Name
genericalizeDecs :: [Dec] -> [Dec]
headOfType :: Type -> Name
occursInType :: Name -> Type -> Bool

-- | Assuming that we're building an instance of the form C (T v_1 ...
--   v_(n-1)) for some GADT T, this function takes a list of the variables
--   v_1 ... v_(n-1) used in the instance head, as well as the result type
--   of some data constructor, say T x_1 ... x_(n-1) x_n, as well as the
--   type t of some argument to it, and substitutes any of x_i (1 &lt;= i
--   &lt;= n-1) occurring in t for the corresponding v_i, taking care to
--   avoid name capture by foralls in t.
substVarsWith :: [Name] -> Type -> Type -> Type

-- | Determine the arity of a kind. Starting in template-haskell 2.8.0.0,
--   <a>Kind</a> and <a>Type</a> became synonymous.
kindArity :: Kind -> Int

-- | Given the name of a type constructor, determine its full arity
tyConArity :: Name -> Q Int

-- | Given the name of a type constructor, determine a list of type
--   variables bound as parameters by its declaration, and the arity of the
--   kind of type being defined (i.e. how many more arguments would need to
--   be supplied in addition to the bound parameters in order to obtain an
--   ordinary type of kind *). If the supplied <a>Name</a> is anything
--   other than a data or newtype, produces an error.
tyConArity' :: Name -> Q ([TyVarBndr BndrVis], Int)

-- | Determine the constructors bound by a data or newtype declaration.
--   Errors out if supplied with another sort of declaration.
decCons :: Dec -> [Con]

-- | Determine the arity of a data constructor.
conArity :: Con -> Int
