且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

限制单子的现状是什么?

更新时间:2023-11-20 18:56:22

最近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:

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.