https://github.com/ocramz/tagless-staged
Notes from "Combinators for Impure yet Hygienic Code Generation"
https://github.com/ocramz/tagless-staged
generative-programming metaprogramming multi-stage-programming tagless-final
Last synced: about 2 months ago
JSON representation
Notes from "Combinators for Impure yet Hygienic Code Generation"
- Host: GitHub
- URL: https://github.com/ocramz/tagless-staged
- Owner: ocramz
- Created: 2021-11-24T04:45:27.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-11-24T17:29:26.000Z (over 3 years ago)
- Last Synced: 2025-02-01T11:28:45.016Z (4 months ago)
- Topics: generative-programming, metaprogramming, multi-stage-programming, tagless-final
- Language: Haskell
- Homepage:
- Size: 11.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# tagless-staged
Notes from "Combinators for Impure yet Hygienic Code Generation" by Kameyama et al., adapted to a contemporary version of 'base' and 'template-haskell'.
This is a "tagless final" approach to implementing an embedded DSL (i.e. using typeclassed for encoding a higher-order abstract syntax). This approach has the benefit of being modular (since different interpretations might require different subsets of the API), and quite well suited to code generation.
Here we use :
* the Compose functor combinator, called 'J' in the paper
* typed TH here to greatly simplify the code generation interpreterpaper : https://okmij.org/ftp/tagless-final/TaglessStaged/beyond.pdf
code : https://okmij.org/ftp/tagless-final/TaglessStaged/TSCore.hs
Also includes part the "reflection-reification" typeclass to enable simplification of terms by pattern matching, suitable for tagless DSLs :
https://okmij.org/ftp/tagless-final/course/optimizations.html#circuit-tut