是否有普通Haskell运算符的可读名称? [英] Are there pronounceable names for common Haskell operators?

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

问题描述

我正在阅读 了解你对Haskell的好作品 ,我永远不知道如何发音Haskell运营商。他们有真实的名字吗? ?



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

  Just(+3)*>我知道>> =  

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

我意识到您可以创建自己的运营商,所以当然,并不是所有的操作员都可以拥有姓名,但我希望常见的操作符(例如 Applicative Monad )必须有名字...

解决方案

以下是我如何发音:

 
>> =绑定
>>然后
*>然后
- >到 - > b:a到b
< - 绑定(因为它解析为>> =)
<$>(f)map
<$ map-replace by 0 <$ f:f map-replace by 0

ap(ply)(因为它与Control.Monad.ap相同)
$ (none,就像[whitespace])
。管道到 a。 b:b管到!索引
!索引/严格
a! b:a index b,foo!x:foo strict x
或/ alternative expr< |> term:expr or term
++ concat / plus / append
[]空列表
:cons
:: type / as fx :: Int:int类型的fx

\ lambda
@ as go ll @(l:ls):go ll as l ls 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天全站免登陆