常见的 Haskell 运算符是否有可发音的名称? [英] Are there pronounceable names for common Haskell operators?

查看:27
本文介绍了常见的 Haskell 运算符是否有可发音的名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读 Learn You a Haskell for Great Good,但我不知道如何发音 Haskell 运算符.他们有真实"的名字吗??

例如,你如何大声朗读这样的表达?

只是 (+3) <*>才 9

我知道 >>= 是绑定",但其他的呢?由于 Google 不考虑非字母数字字符,因此很难进行有效的搜索...

我意识到你可以创建自己的操作符,所以当然不是所有的操作符都可以有名字,但我希望通用的(例如那些在 ApplicativeMonad 中定义的>) 必须有名字...

解决方案

我是如何发音的:

<前>>>= 绑定>> 然后*> 那么-> 到 a -> b: a 到 b<- 绑定 (因为它脱糖为 >>=)<$> (f) 地图<$ map-replace by 0 <$ f: "f map-replace by 0"<*> ap(ply) (因为它与 Control.Monad.ap 相同)$ (none, 就像 " " [空格]).管道到 a .b: "b 管道到 a"!!指数!索引/严格 a !b: "a 索引 b", foo !x: foo strict x<|> 或/替代 expr <|> term: "expr or term"++ 连接/加/附加[] 空列表: 缺点:: of type/as f x :: Int: f x of type Intλ@ as go ll@(l:ls): go ll as l cons ls~ lazy go ~(a,b): 去惰性对 a, b

I'm reading Learn You a Haskell for Great Good, and I never know how to pronounce the Haskell operators. Do they have "real" names? ?

For instance, how do you read aloud an expression like this one?

Just (+3) <*> Just 9

I know that >>= is "bind", but what about the others? Since Google doesn't take non-alphanumeric characters into account, it's kind of hard to do an efficient search...

I realize you can create your own operators, so of course not all operators can have names, but I expect that the common ones (e.g. those defined in Applicative or Monad) must have names...

解决方案

Here is how I pronounce them:

>>=     bind
>>      then
*>      then
->      to                a -> b: a to b
<-      bind              (as it desugars to >>=)
<$>     (f)map
<$      map-replace by    0 <$ f: "f map-replace by 0"
<*>     ap(ply)           (as it is the same as Control.Monad.ap)
$                         (none, just as " " [whitespace])
.       pipe to           a . b: "b pipe-to a"
!!      index
!       index / strict    a ! b: "a index b", foo !x: foo strict x
<|>     or / alternative  expr <|> term: "expr or term"
++      concat / plus / append
[]      empty list
:       cons
::      of type / as      f x :: Int: f x of type Int
       lambda
@       as                go ll@(l:ls): go ll as l cons ls
~       lazy              go ~(a,b): go lazy pair a, b

这篇关于常见的 Haskell 运算符是否有可发音的名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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