pituicat/src/Affection/MessageBus/Message.hs
2017-11-27 02:18:23 +01:00

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