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

前端 未结 3 1790
星月不相逢
星月不相逢 2021-02-04 01:58

I wanted to learn Template Haskell but all tutorials I find either assume that you learned lisp and know what lisp macros are, or that you know some cs theory jargon - things as

3条回答
  •  旧巷少年郎
    2021-02-04 02:53

    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.

提交回复
热议问题