pituicat/src/Affection/MessageBus/Message.hs

19 lines
449 B
Haskell
Raw Normal View History

2017-11-27 00:43:43 +00:00
{-# LANGUAGE RankNTypes #-}
2017-11-26 21:26:41 +00:00
module Affection.MessageBus.Message where
2017-11-27 00:43:43 +00:00
import Data.Time.Clock (UTCTime(..))
2017-11-26 21:26:41 +00:00
class Message msg where
2017-11-27 00:43:43 +00:00
msgTime :: msg -> UTCTime
data EngineMessage m
= MsgUserMessage
{ msgPayload :: m
, msgWhen :: UTCTime
} -- ^ Generic user defined message with custom payload
| MsgEngineReady UTCTime
instance Message (EngineMessage m) where
msgTime (MsgUserMessage _ t) = t
msgTime (MsgEngineReady t) = t