如何在Haskell中免费获得两个值? [英] How to get two values from one, point free, in Haskell?
本文介绍了如何在Haskell中免费获得两个值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
v
和一个函数 f
,有没有办法获得(fv,v)
点免费吗? 解决方案
功能 h
和 f
包含适当的类型,
h>> = f = \ w - > f(hw)w
所以你可以写下
f>> =(,)
For example, given a value, v
, and a function f
, is there a way to get (f v,v)
point free?
解决方案
Alternatively, note that for functions h
and f
with appropriate types,
h >>= f = \w -> f (h w) w
so you can write
f >>= (,)
这篇关于如何在Haskell中免费获得两个值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文