@hackage ghc-hs-meta0.1.0.0
Translate Haskell source to Template Haskell expression
Categories
License
BSD-3-Clause
Maintainer
zac.wood@hey.com
Links
Versions
Installation
Tested Compilers
Dependencies (5)
- base >=4.14 && <4.17
- bytestring >=0.10 && <0.12
- template-haskell >=2.16.0 && <2.19
- ghc >=8.10.7 && <9.3
- ghc-boot >=8.10.7 && <9.3 Show all…
Dependents (2)
@hackage/exon, @hackage/yasi
ghc-hs-meta
Generate Template Haskell expressions from Haskell source code using the GHC parser. This package runs on GHC versions 8.10.7, 9.0.2, and 9.2.1.
Usage
Pass a String containing Haskell source code to parseExp
.
Example from the tests:
case parseExp "a @b" of
Right exp -> exp `shouldBe` TH.AppTypeE (TH.VarE (TH.mkName "a")) (TH.VarT (TH.mkName "b"))
Left (_, _, errMsg) -> error errMsg
See Hackage documentation for more documentation.
Thank you, PyF
This code originated from the excellent parser included in the PyF
package.
I extracted the relevant code and refactored/renamed things to be usable in a more general context.
Without PyF, this could wouldn't have been possible. Thank you!
The original license for PyF can be found in the LICENSE-PyF
file included in this repository.