The template-haskell-util package

[Tags:library, mit]

Some functions that might be useful when you use template haskell.


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.0.3, 0.1.0.4, 0.1.1.0
Change log changelog.md
Dependencies base (==4.*), GenericPretty (>=1.2.1), ghc-prim (>=0.3.1.0), template-haskell (>=2.9) [details]
License MIT
Author songzh
Maintainer Haskell.Zhang.Song@hotmail.com
Category Template Haskell
Home page https://github.com/HaskellZhangSong/TemplateHaskellUtils
Uploaded Mon Mar 2 09:33:57 UTC 2015 by songzh
Distributions NixOS:0.1.1.0
Downloads 774 total (14 in the last 30 days)
Votes
0 []
Status Docs available [build log]
Last success reported on 2015-03-02 [all 1 reports]

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees

Readme for template-haskell-util

Readme for template-haskell-util-0.1.1.0

TemplateHaskellUtils

useful functions for you to write template Haskell code

some examples ** Prettyprint

> runQ [| (1+1) * 5|] >>= pp -- or use
> printiQ  [| (1+1) * 5|]
InfixE (Just InfixE (Just LitE (IntegerL 1))
                  (VarE (Name (OccName "+")
                               (NameG' VarName
                                       (PkgName "base")
                                       (ModName "GHC.Num"))))
                   (Just LitE (IntegerL 1)))
      (VarE (Name (OccName "*")
                  (NameG' VarName
                          (PkgName "base")
                          (ModName "GHC.Num"))))
      (Just LitE (IntegerL 5))

** Other helper functions

-- | Apply a list of expression [(+), 1, 2] to (+) 1 2
appExp :: [ExpQ] -> ExpQ

-- | Apply a type constructor, convert [a, b, c] to a b c
appConT :: [TypeQ] -> TypeQ

-- | convert [a, b, c] to a -> b -> c
curryType :: [TypeQ] -> TypeQ