Safe Haskell | None |
---|---|
Language | Haskell2010 |
- appExp :: [ExpQ] -> ExpQ
- appExp' :: [Exp] -> Exp
- appConT :: [TypeQ] -> TypeQ
- appConT' :: [Type] -> Type
- curryType :: [TypeQ] -> TypeQ
- curryType' :: [Type] -> Type
- genBT :: String -> Int -> Q ([TyVarBndr], [TypeQ])
- genBT' :: String -> Int -> ([TyVarBndr], [Type])
- genPE :: String -> Int -> Q ([PatQ], [ExpQ])
- genPE' :: String -> Int -> ([Pat], [Exp])
- appKinds :: [Kind] -> Kind
- curryKind :: [Kind] -> Kind
- getTypeNames :: Type -> [Name]
- getTVBName :: TyVarBndr -> Name
- getCompositeType :: Con -> [Name]
- getConName :: Con -> Name
- seqTuple2 :: (Q a, Q b) -> Q (a, b)
- seqTuple3 :: (Q a, Q b, Q c) -> Q (a, b, c)
- seqTuple4 :: (Q a, Q b, Q c, Q d) -> Q (a, b, c, d)
- rename :: Q Name -> (String -> String) -> Q Name
- rename' :: Name -> (String -> String) -> Name
- rename'' :: Name -> (String -> String) -> Q Name
- nameToExp :: (String -> String) -> Name -> Q Exp
- printQ :: Show a => Q a -> IO ()
Documentation
appConT :: [TypeQ] -> TypeQ Source
Apply a type constructor
| > convert [a, b, c] to a b c like appExp
> pprint $ appConT' (map ConT [''(,), ''Int , ''Bool]) "GHC.Tuple.(,) GHC.Types.Int GHC.Types.Bool" --i.e. (Int,Bool)
curryType :: [TypeQ] -> TypeQ Source
convert [a, b, c] to a -> b -> c
> pprint $ curryType' (map ConT [''Int , ''Int , ''Bool]) "GHC.Types.Int -> GHC.Types.Int -> GHC.Types.Bool"
curryType' :: [Type] -> Type Source
genBT :: String -> Int -> Q ([TyVarBndr], [TypeQ]) Source
> genBT' "a" 3 ([PlainTV a1,PlainTV a2,PlainTV a3],[VarT a1,VarT a2,VarT a3])
Generate a list of type Bind and Type
genPE :: String -> Int -> Q ([PatQ], [ExpQ]) Source
> genPE' "a" 3 ([VarP a1,VarP a2,VarP a3],[VarE a1,VarE a2,VarE a3])
Related patterns and expressions
getTypeNames :: Type -> [Name] Source
Get type Names recursively
getTVBName :: TyVarBndr -> Name Source
Get type var bind name
getCompositeType :: Con -> [Name] Source
Get all names recursively from a constructor
getConName :: Con -> Name Source
Get name from constructors
data Foo = Foo { foo :: Int } > $(nameToExp (++"1") 'foo) "foo1"