Capturing cross-cutting concerns in agent-based models using computational effects

Alegre, Alex · HARVEST (University of Saskatchewan) · 2025

Agent-based modelling is a powerful technique for modelling complex, interconnected, real-world phenomena, but suffers from difficulties in writing maintainable and extensible models using extant frameworks. It has been suggested that agent-based models may benefit in aspects of software engineering such as maintainability and model clarity through the use of DSLs, aspect-oriented programming, and pure functional programming. Bringing these lines of work together, we cover the development of an agent-based modelling DSL and framework in Haskell and Koka, represented using an effect system. The framework we developed displays improvements in aspects of software engineering such as model clarity, separation of concerns, code reuse, flexibility, and composition, partially through access to pure functional programming from the DSL being embedded in these languages. We describe several example models built using the framework we developed, including Conway's Game of Life, Schelling Segregation Scenario, and Predator--Prey (Lotka--Volterra) dynamics.

Read the paper · More papers on PaperTik