haskell-src-meta-mwotton-0.1.0: Parse source to template-haskell abstract syntax.



This module is a staging ground for to-be-organized-and-merged-nicely code.



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.

pp :: (Data a, Ppr a) => a -> StringSource

ppDoc :: (Data a, Ppr a) => a -> DocSource

unQ :: Q a -> aSource

unQ = unsafePerformIO . runQ

splitCon :: Con -> (Name, [Type])Source

Stolen from Igloo's th-lift.

Produces pretty code suitable for human consumption.

arityT :: Type -> IntSource

The arity of a Type.

nameSpaceOf :: Name -> Maybe NameSpaceSource

Randomly useful.

mkFunD :: Name -> [Pat] -> Exp -> DecSource

data Quoter a Source

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.




expQ :: Lift a => String -> Q a
patQ :: Show a => String -> Q a

toExpQ :: Lift a => (String -> Q a) -> String -> ExpQSource

toPatQ :: Show a => (String -> Q a) -> String -> PatQSource

eitherQ :: (e -> String) -> Either e a -> Q aSource

normalizeT :: Data a => a -> aSource