The th-to-exp package

[ Tags: library, template-haskell ] [ Propose Tags ]

This package 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:

>>> 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.


[Skip to Readme]

Properties

Versions 0.0.1.0, 0.0.1.1
Change log CHANGELOG.md
Dependencies base (>=4.9.0.0 && <5), template-haskell (>=2.11.0.0 && <2.13) [details]
License ISC
Author
Maintainer Alexis King
Category Template Haskell
Home page https://github.com/lexi-lambda/th-to-exp#readme
Bug tracker https://github.com/lexi-lambda/th-to-exp/issues
Source repository head: git clone https://github.com/lexi-lambda/th-to-exp
Uploaded Mon Jul 31 18:01:03 UTC 2017 by lexi_lambda
Distributions LTSHaskell:0.0.1.1, NixOS:0.0.1.1, Stackage:0.0.1.1, Tumbleweed:0.0.1.0
Downloads 173 total (12 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2017-07-31 [all 1 reports]
Hackage Matrix CI

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for th-to-exp-0.0.1.1

[back to package description]

th-to-exp Build Status

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:

> 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.