This module is a staging ground for to-be-organized-and-merged-nicely code.
- cleanNames :: Data a => a -> a
- pretty :: Show a => a -> String
- pp :: (Data a, Ppr a) => a -> String
- ppDoc :: (Data a, Ppr a) => a -> Doc
- gpretty :: Data a => a -> String
- unQ :: Q a -> a
- nameToRawCodeStr :: Name -> String
- (|$|) :: ExpQ -> ExpQ -> ExpQ
- (|.|) :: ExpQ -> ExpQ -> ExpQ
- (|->|) :: TypeQ -> TypeQ -> TypeQ
- unForall :: Type -> Type
- functionT :: [TypeQ] -> TypeQ
- mkVarT :: String -> TypeQ
- myNames :: [Name]
- tvbName :: TyVarBndr -> Name
- splitCon :: Con -> (Name, [Type])
- strictTypeTy :: StrictType -> Type
- varStrictTypeTy :: VarStrictType -> Type
- conTypes :: Con -> [Type]
- conToConType :: Type -> Con -> Type
- decCons :: Dec -> [Con]
- decTyVars :: Dec -> [Name]
- decName :: Dec -> Maybe Name
- foreignName :: Foreign -> Name
- unwindT :: Type -> [Type]
- unwindE :: Exp -> [Exp]
- arityT :: Type -> Int
- typeToName :: Type -> Maybe Name
- nameSpaceOf :: Name -> Maybe NameSpace
- conName :: Con -> Name
- recCName :: Con -> Maybe Name
- dataDCons :: Dec -> [Con]
- fromDataConI :: Info -> Q (Maybe Exp)
- fromTyConI :: Info -> Maybe Dec
- mkFunD :: Name -> [Pat] -> Exp -> Dec
- mkClauseQ :: [PatQ] -> ExpQ -> ClauseQ
- data Quoter a = Quoter {}
- quasify :: (Show a, Lift a) => Quoter a -> QuasiQuoter
- toExpQ :: Lift a => (String -> Q a) -> String -> ExpQ
- toPatQ :: Show a => (String -> Q a) -> String -> PatQ
- showToPatQ :: Show a => a -> PatQ
- eitherQ :: (e -> String) -> Either e a -> Q a
- normalizeT :: Data a => a -> a
Documentation
cleanNames :: Data a => a -> aSource
pretty :: Show a => a -> StringSource
The type passed in must have a Show
instance which
produces a valid Haskell expression. Returns an empty
String
if this is not the case. This is not TH-specific,
but useful in general.
nameToRawCodeStr :: Name -> StringSource
splitCon :: Con -> (Name, [Type])Source
Stolen from Igloo's th-lift.
Produces pretty code suitable for human consumption.
strictTypeTy :: StrictType -> TypeSource
conToConType :: Type -> Con -> TypeSource
foreignName :: Foreign -> NameSource
typeToName :: Type -> Maybe NameSource
nameSpaceOf :: Name -> Maybe NameSpaceSource
Randomly useful.
fromTyConI :: Info -> Maybe DecSource
The strategy for producing QuasiQuoters which
this datatype aims to facilitate is as follows.
Given a collection of datatypes which make up
the to-be-quasiquoted languages AST, make each
type in this collection an instance of at least
Show
and Lift
. Now, assuming parsePat
and
parseExp
, both of type String -> Q a
(where a
is the top level type of the AST), are the pair of
functions you wish to use for parsing in pattern and
expression context respectively, put them inside
a Quoter
datatype and pass this to quasify.
showToPatQ :: Show a => a -> PatQSource
normalizeT :: Data a => a -> aSource