Is there any Template Haskell tutorial for someone who doesn't know Lisp?

二次信任 提交于 2019-12-03 00:05:38
Don Stewart

No, I don't think there are any great introductory tutorials to Template Haskell. The best way to learn is to look at examples, or:

I never found Lisp was a requirement, however there is terminology to learn, like for any domain-specific library.

The best introductory tutorials to Template Haskell I know of are two documents by Bulat Ziganshin. The links from the Haskell Wiki seem to be broken at the moment, however you can access them via archive.org:

Also the original paper Template metaprogramming for Haskell by Tim Sheard and Simon Peyton Jones might be helpful:

Abstract

We propose a new extension to the purely functional programming language Haskell that supports compile-time meta-programming. The purpose of the system is to support the algorithmic construction of programs at compile-time.

The ability to generate code at compile time allows the programmer to implement such features as polytypic programs, macro-like expansion, user directed optimization (such as inlining), and the generation of supporting data structures and functions from existing data structures and functions.

Our design is being implemented in the Glasgow Haskell Compiler, ghc.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!