let*_*aik 1 haskell tuples arrows generic-programming
foo (a1,a2) (b1,b2) (c1,c2) = (bar a1 b1 c1, bar2 a2 b2 c2)
Run Code Online (Sandbox Code Playgroud)
我有很多具有不同数量的参数元组的构造.如果是
foo' (a1,a2) = (bar' a1, bar2' a2)
Run Code Online (Sandbox Code Playgroud)
我想"嘿,那是箭头!":
foo' = bar' *** bar2'
Run Code Online (Sandbox Code Playgroud)
但我还不知道具有多个输入元组的函数(如第一个代码行中)是否以及如何映射到箭头样式.什么是处理这些功能的通用方法?理想情况下,我总是想要这样的东西foo = bar ... bar2
.
let (****) = uncurry (***) in (bar1, bar2) **** (a1, a2) **** (b1, b2) **** (c1, c2)
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
191 次 |
最近记录: |