AI Multi-agents, Arrows, and the Future
摘要
What an amazing road have we traveled together, dear reader! We started from zero, pure mathematical nothingness. We learned how to construct increasingly complex types from basic numbers and symbols. We mastered the typed functional problem solving where we decompose the problem into smaller pieces and make sure the types match. We learned to build functions between these types. We introduced and built the typeclass hierarchy from the foundational Monoid to the Functor–Applicative–Monad triplet and to various useful extensions. We glanced over Type Theory and Category Theory and learned to represent our problem domain visually as a small category, with objects being types and typeclasses defining structure between those types. We “invented” the State monad, looked at its sisters – Reader and Writer – and built several increasingly complex monad transformer stacks to create end-to-end Haskell programs. We mastered the terminal UI and how to create web applications. We discovered mutability and designed our own amazing mutable RWST monad, which is usable for any web app out of box. We learned basic multi-threading and how to run both web and terminal UIs in one application. We delved into advanced mutable variables from IORef, to MVar, to TVar, and to an amazing and a bit obscure ST monad. We built up our abstraction hierarchy to understand type families and learned how to use vectors efficiently. We even touched upon rank-N types and type application concepts. And the best part – we applied all of these very much advanced concepts in practice while building a practically useful AI framework that includes MongoDB, Vector RAG, and direct OpenAI access and fully built out a solid skeleton of a production app.