我已经研究过“提升”q/a 的例子,在我看来提升函数就像任何改变形状的转换函数(如单子转换)。
我是否遗漏了任何点或提升功能(“提升概念”)是否有任何规则?
如果不是,它只是功能转换中的概念吗?
我已经研究过“提升”q/a 的例子,在我看来提升函数就像任何改变形状的转换函数(如单子转换)。
我是否遗漏了任何点或提升功能(“提升概念”)是否有任何规则?
如果不是,它只是功能转换中的概念吗?
Lifting doesn't change the 'shape', just the 'type'. By this I mean that lifting a function into, e.g., a List<A>
results in a List<B>
. The shape (List
) doesn't change, but the specific type may.
You are right that it is similar to any other transformation. In fact, the standard operation map
is the mechanism of 'lifting' a function of a single variable into the Functor (the datatype being mapped over). So, you can think of map
as lift1
, then you have lift2
(for functions of two variables), etc.