Files
sml-projects/shell/updater.sml

31 lines
693 B
Standard ML
Raw Normal View History

structure Updater =
2024-10-06 09:32:56 +01:00
struct
open MailboxType
2025-08-04 09:29:37 +01:00
open InputMsg
2024-10-06 09:32:56 +01:00
fun sendMsg msg =
case msg of
DRAW msg => DrawMailbox.append msg
| SEARCH (buffer, searchString, time) =>
Mailbox.send (SearchMailbox.mailbox, (buffer, searchString, time))
2024-10-06 09:32:56 +01:00
fun sendMsgs msgList =
2024-10-06 09:32:56 +01:00
case msgList of
hd :: tl => let val () = sendMsg hd in sendMsgs tl end
2024-10-06 09:32:56 +01:00
| [] => ()
fun update (app: AppType.app_type, inputMsg) =
2024-10-06 09:32:56 +01:00
let
val time = Time.now ()
2025-08-04 09:29:37 +01:00
val () = ExceptionLogger.addCommand inputMsg
val app = AppUpdate.update (app, inputMsg, time)
2025-08-06 00:16:50 +01:00
handle e => ExceptionLogger.log e
val () = sendMsgs (#msgs app)
2024-10-06 09:32:56 +01:00
in
app
2024-10-06 09:32:56 +01:00
end
end