Good examples of Not a Functor/Functor/Applicative/Monad?

10/14 02:27
阅读数 0

问题:

While explaining to someone what a type class X is I struggle to find good examples of data structures which are exactly X.在向某人解释什么是类型类 X 时,我很难找到恰好是 X 的数据结构的好例子。

So, I request examples for:因此,我请求以下示例:

  • A type constructor which is not a Functor.不是 Functor 的类型构造函数。
  • A type constructor which is a Functor, but not Applicative.一个类型构造函数,它是一个 Functor,但不是 Applicative。
  • A type constructor which is an Applicative, but is not a Monad.一个类型构造函数,它是一个 Applicative,但不是一个 Monad。
  • A type constructor which is a Monad.一个类型构造函数,它是一个 Monad。

I think there are plenty examples of Monad everywhere, but a good example of Monad with some relation to previous examples could complete the picture.我认为到处都有很多 Monad 的例子,但是一个很好的 Monad 例子与之前的例子有一些关系可以完成这幅画。

I look for examples which would be similar to each other, differing only in aspects important for belonging to the particular type class.我寻找彼此相似的示例,仅在对属于特定类型类的重要方面有所不同。

If one could manage to sneak up an example of Arrow somewhere in this hierarchy (is it between Applicative and Monad?), that would be great too!如果有人可以设法在这个层次结构中的某个地方偷偷摸摸一个 Arrow 的例子(它是在 Applicative 和 Monad 之间吗?),那也太棒了!


解决方案:

参考一: https://en.stackoom.com/question/UIMe
参考二: https://stackoom.com/question/UIMe
展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部