应用(和朋友)方法是否有人性化的名称? [英] Are there human-friendly names for applicative (and friends) methods?

查看:121
本文介绍了应用(和朋友)方法是否有人性化的名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我一直在使用应用(和替代),而让我感到沮丧的一件事是我缺乏对命名的了解。作为一个例子,我希望能够说函数名称而不是 star thing 代替< * GT; 。因此,与>> = 读取 bind 几乎一样,是否还有更多人性化的名称如下所示:


  • <> - apply?

  • < * & *> - 左右适用?

  • < $> - fmap?

  • < |>



同样来自箭头


  • *** - 分割

  • &&& - fanout?



如果有这些名称,我的搜索没有发现它们。我知道这里可能没有公认的条款,但是如果有的话我很想知道它们。

< $> fmap 的同义词。此外,应用这个名字让我想到应用的东西。既然<> 是做这件事的主要操作符,我想我把它与单词apply松散地联系起来。上下文与正常的函数应用稍有不同,所以可能会对这个单词产生一些混淆,但上下文通常足够清楚,所以对我来说很有用。 <> 也是Control.Monad的 ap 函数的同义词,所以这证实了我使用单词apply。

<>布伦特Yorgey的 Typeclassopedia 是我学到的大部分内容。这是一个出色的资源。


I've been using applicative (and alternative) a fair bit lately, and one thing that has been frustrating me is my lack of knowledge of the nomenclature. As an example, I'd like to be able to say function name instead of star thing for <*>. So, in much the same way that >>= is read bind, are there more human-friendly names for the following:

  • <*> - apply?
  • <* & *> - left and right apply?
  • <$> - fmap?
  • <|>

and likewise from arrows

  • *** - split?
  • &&& - fanout?

If there are names for these, my searches haven't uncovered them. I understand that there might not be accepted terms for these, but if there are I'd love to know them.

解决方案

Well, <$> is a synonym for fmap. Also, the name "applicative" makes me think of applying things. Since <*> is the main operator for doing that, I think I associate it loosely with the word "apply". The context is slightly different from normal function application so there could be some confusion with that word, but the context usually makes it clear enough, so it works for me. <*> is also a synonym for the ap function from Control.Monad, so this confirms my use of the word "apply".

Brent Yorgey's Typeclassopedia is where I learned most of this. It's an outstanding resource.

这篇关于应用(和朋友)方法是否有人性化的名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆