有没有针对不懂 Lisp 的人的 Template Haskell 教程?
我想学习 Template Haskell,但我发现所有教程要么假设你学过 lisp 并知道什么是 lisp 宏,要么你知道一些 cs 理论术语 - 比如拼接、准引用等…… - 或者一些关于宏的理论结果。
我无法编写一行 lisp 代码(而且,虽然我打算有一天这样做,但我现在没有时间学习它)。 Haskell 是我的第一个函数式语言,我学会了它,以至于我可以定期用它编写代码,使用 monad,applicative,理解类型系统等等......但我知道的不多(也想学习,但我我太愚蠢了...:P) 关于它背后的理论 cs 内容。所以我忽略了我通常在 TH 教程中找到的术语。
所以,问题是:是否有一个关于 TH 的教程,适合那些编写 Haskell 代码的人,而不是作为一名专业计算机科学家,而是作为一个使用编程来完成日常琐事的人,他学习 Haskell 作为他的第一个函数式语言?也许以 TH 为例介绍宏和元编程?
谢谢大家。 :)
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 splices, quasiquotations, etc... - or some theoretical results about macros.
I can't code a single line of lisp (and, though I intend to do this some day, I don't have the time to learn it right now). Haskell is my very first functional language and I learned it to the point that I can regularly code in it, use monads, applicative, understand the type system, etc... but I don't know much (also want to learn but I'm too stupid for it... :P) about the theoretical cs stuff behind it. So I'm oblivious to the jargon I typically find on TH tutorials.
So, the question is: is there a tutorial about TH for someone who code Haskell, not as a professional computer scientist, but just as a guy who uses programming for his daily chores, who learned Haskell as his first functional language? Maybe a introduction to macros and meta-programming that use TH as example?
Thanks all. :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不,我认为没有任何关于 Template Haskell 的优秀入门教程。最好的学习方法是查看示例,或者:
I从来没有发现 Lisp 是必需的,但是有术语需要学习,就像任何特定领域的库一样。
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.
我所知道的 Template Haskell 最好的入门教程是 Bulat Ziganshin 的两篇文档。来自 Haskell Wiki 的链接目前似乎已损坏,但是您可以通过 archive.org 访问它们:
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:
还有原始论文Haskell 的模板元编程蒂姆·谢尔德和西蒙·佩顿·琼斯的作者可能会有所帮助:
Also the original paper Template metaprogramming for Haskell by Tim Sheard and Simon Peyton Jones might be helpful: