hemanth / functional-programming-jargon

Jargon from the functional programming world in simple terms!
http://git.io/fp-jargons
MIT License
18.59k stars 1.02k forks source link

Natural transformations #216

Open MostAwesomeDude opened 2 years ago

MostAwesomeDude commented 2 years ago

The goal of category theory is to define natural transformations; categories were originally an auxiliary concept. If categories and functors are covered, then natural transformations should be covered too.

MostAwesomeDude commented 2 years ago

As a strawman suggestion which I hope people can improve, I might start with something like...

A natural transformation is a mapping from one functor to another. They are "natural" because the transformation does not care which type is inside the functor. For example, there is a natural transformation from binary trees to lists; if we take a binary tree and traverse it, then we can build a list of its leaves, and we can do this for any type of leaf. We can turn a binary tree of integers into a list of integers, or a binary tree of strings into a list of strings.

See also #217.