18 lines
449 B
Haskell
18 lines
449 B
Haskell
{-# LANGUAGE RankNTypes #-}
|
|
module Affection.MessageBus.Message where
|
|
|
|
import Data.Time.Clock (UTCTime(..))
|
|
|
|
class Message msg where
|
|
msgTime :: msg -> UTCTime
|
|
|
|
data SystemMessage m
|
|
= MsgUserMessage
|
|
{ msgPayload :: m
|
|
, msgWhen :: UTCTime
|
|
} -- ^ Generic user defined message with custom payload
|
|
| MsgEngineReady UTCTime
|
|
|
|
instance Message (SystemMessage m) where
|
|
msgTime (MsgUserMessage _ t) = t
|
|
msgTime (MsgEngineReady t) = t
|