HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulehaskell-src-meta-0.8.15Haskell2010

Language.Haskell.Meta.Utils

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

  • 46 values
valuepretty :: Show a => a -> String
#

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.

valueunsafeRunQ :: Q a -> a
#
unsafeRunQ = unsafePerformIO . runQ
valuemyNames :: [Name]
#

Infinite list of names composed of lowercase letters

valuerenameThings
  1. :: t1 -> t2 -> a1 -> (a2, t1, t2)
  2. -> t1
  3. -> t2
  4. -> [a2]
  5. -> [a1]
  6. -> ([a2], t1, t2)
#

Generalisation of renameTs

valuerenameT
  1. :: [(Name, Name)]
  2. -> [Name]
  3. -> Type
  4. -> (Type, [(Name, Name)], [Name])
#

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.

valuetoExpQ :: Lift a => (String -> Q a) -> String -> ExpQ
#

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.

Orphan instances

6 instances