[英]Applicative style for infix operators?
Is there a way to make applicative uses of <$>
and <*>
look nice when dealing with infix operators? 在处理中缀运算符时,是否有办法使
<$>
和<*>
应用程序看起来很好用? I think that 我觉得
((++) <$> a <*> ((++) <$> b <*> c ))
looks much more cluttered then 看起来更加混乱
a ++ b ++ c
so I wonder if there is a nicer way. 所以我想知道是否有更好的方式。
(<++>) = liftA2 (++)
a <++> b <++> c
or 要么
liftA2 (++) a $ liftA2 (++) b c
请参阅Thomas Davie的InfixApplicative软件包,它提供了一般的语法技巧,而不必为每次提升定义一个新的运算符。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.