https://ncatlab.org/nlab/show/identity+functor
The identity functor on a category C is the functor idC:C→C that maps each object and morphism of C to itself. The identity functors are the identities for composition of functors in Cat.
https://ncatlab.org/nlab/show/function+application
A function f is defined by its association to each input value x (belonging to some allowable domain of values) of an output value, usually denoted f(x) or fx. The process of passing from f and x to f(x) is called function application, and one speaks of applying f to x to produce f(x).
https://ncatlab.org/nlab/show/Set
Is an identity functor in Category of sets a function application?
The reason I ask this is in proguramming such as F#, pipeline operator
https://riptutorial.com/fsharp/example/14158/pipe-forward-and-backward
"Hello World" |> print
value |> f
Now,
value |> map(f)
is generally recognized as functor.
In this understanding, a simple function application
value |> f
should be an identity functor, is this correct?
Thanks.
EDIT
(endo)Functor
value |> map(f)
identityFunctor (special case: map
== identity
)
value |> identity(f)
Therefore, identityFunctor is equivalent to
function application
value |> f
in another notation,
f(value)
When translating from category theory to a programming language, replace "object" with "type" and "morphism" with "function".
When you say that
value |> map(f)
is recognized as functor, the functor part is actually related to the type of thevalue
. This type was created by applying a type constructor to some other type. For instance,value
may be a list of integers: the functor "list" was applied to "integer". Functionf
, in this case, operates on integers, butmap(f
) operates on lists of integers. We say thatmap
"lifts"f
to operate on lists.Identity functor maps every type to itself. So, for instance, it maps type int to type int. In this case
map(f)
is the same asf
: liftedf
is againf
.Function application is a morphism. It takes a pair (a product) of the function type and the argument type and maps it to the result type. Here, it takes the pair
(f, value)
.