身份类型的规范名称是什么?

What is the canonical name for the identity type?

我最近在这里回答了一个问题:

这是上面的代码片段:

trait FooBar[M[_]] {
  val foo: M[Integer]
  val bar: M[String]
}

type Identity[X] = X
type A = FooBar[Identity]
type B = FooBar[Option]

我看到这个用过几次:

type Identity[X] = X

但是,这个(Identity 类型或一般的技术)在范畴论文献中的名称是什么? Lift 是更好的名字吗?

在数学中,这叫做 Identity Function:

In mathematics, an identity function, also called an identity relation or identity map or identity transformation, is a function that always returns the same value that was used as its argument. In equations, the function is given by f(x) = x.

更正式的数学定义如下:

Formally, if M is a set, the identity function f on M is defined to be that function with domain and codomain M which satisfies: f(x) = x for all elements x in M. In other words, the function assigns to each element x of M the element x of M.

如果您要专门查找范畴论定义,则称为 Identity Morphism。维基百科值讲到态射合成,然后把恒等态射描述为:

Identity: for every object X, there exists a morphism idX : X → X called the identity