https://github.com/lexi-lambda/th-to-exp
Deprecated. Use Language.Haskell.TH.Syntax.Lift instead.
https://github.com/lexi-lambda/th-to-exp
Last synced: 2 months ago
JSON representation
Deprecated. Use Language.Haskell.TH.Syntax.Lift instead.
- Host: GitHub
- URL: https://github.com/lexi-lambda/th-to-exp
- Owner: lexi-lambda
- License: isc
- Created: 2016-11-07T23:19:43.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-07-31T18:01:26.000Z (almost 8 years ago)
- Last Synced: 2025-04-13T17:09:26.476Z (2 months ago)
- Language: Haskell
- Homepage:
- Size: 7.81 KB
- Stars: 4
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# th-to-exp [](https://travis-ci.org/lexi-lambda/th-to-exp)
`th-to-exp` is a package that provides a way to persist data from compile-time to runtime by producing Template Haskell expressions that evaluate to particular values. For example, if you have a value `Just 1`, then `toExp (Just 1)` will produce the *expression* `[e| Just 1 |]`, which can be used in a splice. For a more direct example, here’s what that looks like without the quasiquote notation:
```haskell
> toExp (Just 1)
AppE (ConE GHC.Base.Just) (LitE (IntegerL 1))
```This is done by using a typeclass, `ToExp`, that can be automatically derived for types that have a `Generic` instance.