Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

curry is the factorizer for the universal construction

I am reading category theory for programmers about functions type.

He says:

Notice that curry is the factorizer for the universal construction of the function object. This is especially apparent if it’s rewritten in this form:

factorizer :: ((a, b)->c) -> (a->(b->c))
factorizer g = \a -> (\b -> g (a, b))

(As a reminder: A factorizer produces the factorizing function from a candidate.)

What is a 'factorizer' and 'universal construction'?

What is he trying to explain about currying?

like image 294
softshipper Avatar asked Nov 28 '25 12:11

softshipper


1 Answers

The idea of a universal construction and a factorizer was introduced in earlier chapters (in particular in the one about the product and coproduct).

In short, a universal construction compares all possible candidates that share a given property. Here, the candidate is an object z with a morphism g going from (z × a) to b. The best such candidate is an object denoted by (a=>b) with the morphism called eval.

The universal property is that for any candidate z together with g there is a unique morphism h that factorizes the diagram given in the picture. A factorizer is a recipe for obtaining this h given z and g, in a particular category. In Haskell, g is a function ((a, z)-> b) and h is a function (z -> (a -> b)). So, up to renaming of variables and symmetry of the product, the factorizer has exactly the signature of curry.

like image 122
Bartosz Milewski Avatar answered Nov 30 '25 04:11

Bartosz Milewski