Fork me on GitHub

hi, I hope this is a good place to ask general category theory questions related to Clojure simple_smile


I started learning Haskell for a bit but don't know enough to be comfortable using it for real world stuff, and now I have a project that I think might be a good fit for me to apply some CT concepts to develop a better understanding of its uses


so I plan on using cats, and but before I begin I was hoping to get some guidance


my project has to do with interacting an external process that I communicate through stdin / stdout


the process has its own imperative language through which it does things, and I'd like to build a more declarative interface for interacting with it


so I plan on representing those instructions with tagged vectors, Hiccup style


some of the instructions have return values and some are purely for side effects


the process is a type of solver, where you set up a scenario using the imperative instructions, let it run on it for a while and then you can query results, save it to disk, or you can load an already solved result and query that


so there's different things I want to be able to do


- 1) build up scenarios and save these as "recipes" which I can schedule to be solved later - 2) schedule these recipes to be solved - 3) query the results in a declarative language - 4) mix 3) and 1) together, so that the recipes can be built based on the results of previous solutions


I'd like the query language to be able to figure out what it needs to return its result, and if that data doesn't exist yet then instead of returning empty handed, it can give me back the recipe for generating that data


so from CT perspective, the first thing I thought of is that the imperative instruction set can be thought of as a monoid, since feeding commands to the solver is just string concatenation


and the process of turning a recipe(s) into a solution, where I want fine control over when and in which order that happens, feels very much like an IO monad


I don't know if the concept of an IO monad makes much sense in Clojure though


I'm partly rambling just to try to gather up my own thoughts, but I'm curious how you would approach this problem from the CT perspective, or if anyone has any resources / link / blog posts that might relate to what I'm attempting to do