Modulehaskell-src-meta-0.8.16Haskell2010
Language.Haskell.Meta.Utils
This module is a staging ground for to-be-organized-and-merged-nicely code.
Synopsis
- value applyT
- value arityT
- value cleanNames
- value conName
- value conToConType
- value conTypes
- value dataDCons
- value decCons
- value decName
- value decTyVars
- value eitherQ
- value foreignName
- value fromDataConI
- value fromTyConI
- value functionT
- value gpretty
- value mkClauseQ
- value mkFunD
- value mkVarT
- value myNames
- value nameSpaceOf
- value nameToRawCodeStr
- value normaliseName
- value normalizeT
- value pp
- value ppDoc
- value pretty
- value recCName
- value renameT
- value renameThings
- value renameTs
- value showToPatQ
- value splitCon
- value strictTypeTy
- value substT
- value toExpQ
- value toPatQ
- value typeToName
- value unForall
- value unsafeRunQ
- value unwindE
- value unwindT
- value varStrictTypeTy
- value |$|
- value |->|
- value |.|
- Packagehaskell-src-meta-0.8.16
- Exports46
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceUtils.hs
The arity of a Type.
Infinite list of names composed of lowercase letters
Randomly useful.
Remove qualification, etc.
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.
Rename type variables in the Type according to the given association list. Normalise constructor names (remove qualification, etc.) If a name is not found in the association list, replace it with one from the fresh names list, and add this translation to the returned list. The fresh names list should be infinite; myNames is a good example.
Generalisation of renameTs
renameT applied to a list of types
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.
unsafeRunQ = unsafePerformIO . runQ