Category theory applied to C++ ... can this be done in Prolog as well

Hello,

I came across a very nice article on how category theory can be applied in C++ to provide another dimension of flexibility, based on the composition of (monad) functions.

I noticed that it includes capabilities also discussed in prolog such as co-routines and continuation and futures (when?).

I wonder if category theory has same broad application in Prolog or whether it does require a functional outlook – and relational thinking is too broad a concept.

any thoughts are much appreciated,

Dan

[1] https://bartoszmilewski.com/2020/08/05/categories-for-the-working-c-programmer/

Why don’t you ask the author of the noted blog?

EDIT

At StackExchange

Computer Science tag: Category Theory
Theoretical Computer Science tag: Category Theory
Mathematics tag: Category Theory

Hi Eric,

Yes, i want to ask him as well … although, I thought to first post a question here, where the experts in relational (as an extension to functional) thinking are …

Edit:

Perhaps, there is a need to generalize category theory from a theory of functions to a theory of relations, with current category theory a special case :slight_smile:

Dan

I am only a novice with Category Theory but that statement has me wondering why you say that. Do you have references to papers noting the same? While most of what a programmer reads about Category Theory will relate Category Theory to functions, do not take that to mean that Category Theory can only do functions.

In researching the touch points between Category Theory and programming many years ago for my own benefit, I found that a lot of it flows though one common touch point found by Eugenio Moggi. I won’t give you any more details so that you can see if you can find the touch points and then hopefully learn why, when programmers talk about Category Theory, that the work of Eugenio Moggi seems to be a strange attractor. When you come at Category Theory from the view of someone with a PhD. in Computer Science who studies it, you will get a different view and if you come at Category Theory from the view of of someone with a PhD in Math you will get still another view.

You really should read some of those references I left. I took sometime yesterday to peruse the Q&A and some answers have very good details related to the touch points between Category Theory and what you seek. However there were some other specific questions I was surprised that were not asked.

Hi Eric,

Thank you.

I have been reading up on category theory since my doctoral days – but will little deeper understanding. I keep coming back to it, and love to see examples worked out, like the one on C++, that makes it concrete for me.

I have no reference on category theory and relations – its just my own musing – and wondering – what theory could underpin relational language such as prolog that goes beyond basic set theory.

It seems to me that with modes, prolog subsums functions and hence category theory should be directly applicable – but is there more that can be exploited for novel programming construction abstractions.

Dan

A question almost identical that was asked in one of the noted forums. Don’t ask me exactly which one as I spent a few hours while multitasking at perusing the forums yesterday.

You really should look through some of the Q&A at StackExchange, many people have the same thoughts and ask the same questions. If you read enough of the questions you will start to notice that there are people who only answer questions related to specific areas, you should find those people and reach out to them. Some of them are world experts.