限制单子的现状是什么? [英] What's the current status of restricted monads?
问题描述
Set
, Map
或概率分布。这是几年前的一个SO 问题,其他人发生了冲突这个问题。 人们提出了各种解决方法,包括:
然而,方法似乎是规范的。我在Don Stewart的评论中发现了这篇博文<在2007年,他表示我们与限制monads的相当接近索引类型。
目前状态如何?现在是否有一种规范的方式来限制单子?或者我们仍然与解决方法生活在一起?
最近Anders Persson,Emil Axelsson和Josef Svenningson发表了一篇论文,编码限制单子的方法。我已经忘记了细节,但我记得这是一篇很好的论文。
Persson,A.; Axelsson,E.; Svenningsson,J。(2011)。 嵌入式语言的通用单点构造 。 IFL 2011,第23届功能语言实施与应用研讨会。
Going back to at least the late 1990s there have been people wishing for the integration of restricted monads into Haskell in a friendly way.
For example, without restricted monads you can't make an efficient monad out of Set
, Map
or probability distributions. Here's a SO question from a few years ago where someone else ran afoul of this problem.
There are various workarounds that people have come up with, including:
Creating a new type class for every possible restriction.
Using Template Haskell.
Using Constraint Kinds.
None of these approaches seem to be "canonical" however. I found a comment from Don Stewart on this blog post, in 2007, where he intimated that we were "quite close" to having restricted monads with Indexed types.
What is the current status? Is there now a 'canonical' way to do restricted monads? Or we are still living with workarounds?
There's a recent paper by Anders Persson, Emil Axelsson, and Josef Svenningson that shows a way to encode restricted monads. I've forgotten the details, but I remember it was a nice paper.
Persson, A. ; Axelsson, E. ; Svenningsson, J. (2011). Generic monadic constructs for embedded languages. IFL 2011, the 23rd Symposium on Implementation and Application of Functional Languages.
这篇关于限制单子的现状是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!