move msgs into AppType.app_type, and refactor AppUpdate.update function to have type (app_type -> app_type) instead of pervious case which was (app_type -> app_type * MailboxType.t list). Reason: no need to allocate/return tuple when can store messages in type directly; previous msg list will be reset after each app update. All tests after refactor are passing.

This commit is contained in:
2024-12-17 10:40:06 +00:00
parent 24cdea7da3
commit 90f8732f06
6 changed files with 195 additions and 207 deletions

View File

@@ -17,8 +17,8 @@ struct
fun loop (app: AppType.app_type, inputMailbox, drawMailbox) =
let
val inputMsg = Mailbox.recv inputMailbox
val (app, msgList) = AppUpdate.update (app, inputMsg)
val _ = sendMsgs (msgList, drawMailbox)
val app = AppUpdate.update (app, inputMsg)
val () = sendMsgs (#msgs app, drawMailbox)
in
loop (app, inputMailbox, drawMailbox)
end