TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Exotic List Monads

88 点作者 curryhoward超过 4 年前

5 条评论

nemo1618超过 4 年前
&gt; The usual list monad is only one of infinitely many ways to turn the List functor into a monad.<p>So simple, and yet this is a point that I think is rarely made clear enough in &quot;monad explainers.&quot; For instance, they almost always talk about &quot;the Maybe monad&quot; -- but this is conflating two things: the Maybe <i>data type</i>, and the Monad <i>instance</i> defined on that type. Propagating &quot;Nothing&quot; is <i>not</i> inherent to the Maybe data type, it&#x27;s just a convenient behavior to have.<p>Talking about &quot;the List monad&quot; is even more confusing for a newcomer. When they hear &quot;the List monad implements a kind of nondeterminism,&quot; it sounds like nondeterminism is a property <i>inherent to lists themselves</i> -- but of course it is nothing of the sort. All Monad instances are, in a sense, arbitrary.
评论 #25680456 未加载
评论 #25680066 未加载
评论 #25680619 未加载
评论 #25681769 未加载
lmm超过 4 年前
&gt; In each case return is singleton (it is not known if there exists a monad on lists with a different return).<p>The &quot;diagonal&quot; monad join [[a, b, c, ...], [1, 2, 3, ...], [x, y, z, ...], ...] = [a, 2, z, ...] has return a = [a, a, a, ...], though I guess it&#x27;s hard to define it in a way that&#x27;s well-behaved for finite lists, so you might not consider it &quot;a monad on lists&quot;.
评论 #25681901 未加载
jitl超过 4 年前
No comments, because no one understand these (At least, I don&#x27;t).
评论 #25678906 未加载
评论 #25678958 未加载
ashton314超过 4 年前
I appreciate comment threads like this because it shows me I have a lot to learn. HN is a great place to encounter people smarter than you.
zgotsch超过 4 年前
I don’t see how this has broad appeal, but at least the Mazewalk interpretation is cute.
评论 #25682033 未加载
评论 #25679822 未加载