I am going to use the wonderful library https://tpolecat.github.io/doobie/ and it is fully functional.
I was going through the first example and I have recognized:
A Transactor is a data type that knows how to connect to a database, hand out connections, and clean them up; and with this knowledge it can transform
ConnectionIO ~> IO, which gives us a program we can run.
ConnectionIO ~> IO is a natural transformation in category theory but have never fully understood, what exactly a natural transformation is.
However, I know it is transformation from one category into other category. For example:
F[A] ~> G[A]
is a natural transformation from category F to G without changing the content.
Not everything can be naturally transformed and the question is, how do the author of library doobie know, that he can do the natural transformation from ConnectionIO ~> IO?