I'm having trouble reading zig code, so I'm not sure how much overlap there is but I have done some work with mealy and moore encoded as co-algebras in haskell:
https://blog.cofree.coffee/2025-03-05-chat-bots-revisited/ https://github.com/cofree-coffee/cofree-bot
Also using the lens library to encode moore machines as polynomial functors: https://blog.cofree.coffee/2024-07-02-lensy-moore/