Replies: 1 comment 4 replies
-
I have a heavy interest in both category theory and Prolog, so I thought about things like that before. Prolog is different from Haskell in that it is basically untyped and has all of the non-determinism stuff, so (from what I tried, which was very little) it's hard to make direct analogies with "Haskell style category theory". My intuition is that there is probably a way to formulate Prolog (and things like DCGs) in terms of category theory, but that will probably look very different from Haskell (I don't think DCGs are a Monad for example). In a more practical note, I think trying implement a version of things like monads in Prolog would be very useful. DCGs take a lot of the responsabilities that in Haskell you would give to a monad, like state. However, there are somethings that I think monads do much better than DCGs, like side-effects. The way I've seen to do pure Prolog with side effects is to calculate your whole program with pure Prolog and then do the side effects after. Some helpers like On using Prolog to research category theory, I think it's very promising. Using Prolog and constraints you could "model check" small categories which is interesting, but you could also make more complex proof-systems that handle specific types of categories, like topoi which encode many kinds of logics. I'm very new to category theory and kind of new to Prolog in general also, so please correct me if I said anything incorrect or misleading. |
Beta Was this translation helpful? Give feedback.
-
Of course, strongly typed functional programming languages have long had a categorical flavor. Haskell with its monads, etc. There is a funny story in this blog post, as follows:
All that aside, given the deep undercurrent of logic in category theory, it would seem entirely natural that people would be doing categorical work in Prolog, too. Who is doing such work? (BTW, I posted a question like this on Mathstodon but have not yet received a positive reply.)
Beta Was this translation helpful? Give feedback.
All reactions