You might be interested to look at David Corfield’s book Modal Homotopy Type Theory. In the chapter on modal logic, he shows how all the different variants of modal logic can be understood as monads/comands. This allows us to understand modality in terms of “thinking in a context”, where the context (possible worlds) can be given a rigorous meaning categorically and type theoretically (using slice categories).
You might be interested to look at David Corfield’s book Modal Homotopy Type Theory. In the chapter on modal logic, he shows how all the different variants of modal logic can be understood as monads/comands. This allows us to understand modality in terms of “thinking in a context”, where the context (possible worlds) can be given a rigorous meaning categorically and type theoretically (using slice categories).