module Ribosome.Host.Data.Event where
import Data.MessagePack (Object)
import Ribosome.Host.Class.Msgpack.Decode (MsgpackDecode)
import Ribosome.Host.Class.Msgpack.Encode (MsgpackEncode)
newtype EventName =
EventName { EventName -> Text
unEventName :: Text }
deriving stock (EventName -> EventName -> Bool
(EventName -> EventName -> Bool)
-> (EventName -> EventName -> Bool) -> Eq EventName
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EventName -> EventName -> Bool
$c/= :: EventName -> EventName -> Bool
== :: EventName -> EventName -> Bool
$c== :: EventName -> EventName -> Bool
Eq, Int -> EventName -> ShowS
[EventName] -> ShowS
EventName -> String
(Int -> EventName -> ShowS)
-> (EventName -> String)
-> ([EventName] -> ShowS)
-> Show EventName
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EventName] -> ShowS
$cshowList :: [EventName] -> ShowS
show :: EventName -> String
$cshow :: EventName -> String
showsPrec :: Int -> EventName -> ShowS
$cshowsPrec :: Int -> EventName -> ShowS
Show)
deriving newtype (String -> EventName
(String -> EventName) -> IsString EventName
forall a. (String -> a) -> IsString a
fromString :: String -> EventName
$cfromString :: String -> EventName
IsString, Eq EventName
Eq EventName
-> (EventName -> EventName -> Ordering)
-> (EventName -> EventName -> Bool)
-> (EventName -> EventName -> Bool)
-> (EventName -> EventName -> Bool)
-> (EventName -> EventName -> Bool)
-> (EventName -> EventName -> EventName)
-> (EventName -> EventName -> EventName)
-> Ord EventName
EventName -> EventName -> Bool
EventName -> EventName -> Ordering
EventName -> EventName -> EventName
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: EventName -> EventName -> EventName
$cmin :: EventName -> EventName -> EventName
max :: EventName -> EventName -> EventName
$cmax :: EventName -> EventName -> EventName
>= :: EventName -> EventName -> Bool
$c>= :: EventName -> EventName -> Bool
> :: EventName -> EventName -> Bool
$c> :: EventName -> EventName -> Bool
<= :: EventName -> EventName -> Bool
$c<= :: EventName -> EventName -> Bool
< :: EventName -> EventName -> Bool
$c< :: EventName -> EventName -> Bool
compare :: EventName -> EventName -> Ordering
$ccompare :: EventName -> EventName -> Ordering
Ord, Object -> Either DecodeError EventName
(Object -> Either DecodeError EventName) -> MsgpackDecode EventName
forall a. (Object -> Either DecodeError a) -> MsgpackDecode a
fromMsgpack :: Object -> Either DecodeError EventName
$cfromMsgpack :: Object -> Either DecodeError EventName
MsgpackDecode, EventName -> Object
(EventName -> Object) -> MsgpackEncode EventName
forall a. (a -> Object) -> MsgpackEncode a
toMsgpack :: EventName -> Object
$ctoMsgpack :: EventName -> Object
MsgpackEncode)
data Event =
Event {
Event -> EventName
name :: EventName,
Event -> [Object]
payload :: [Object]
}
deriving stock (Event -> Event -> Bool
(Event -> Event -> Bool) -> (Event -> Event -> Bool) -> Eq Event
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Event -> Event -> Bool
$c/= :: Event -> Event -> Bool
== :: Event -> Event -> Bool
$c== :: Event -> Event -> Bool
Eq, Int -> Event -> ShowS
[Event] -> ShowS
Event -> String
(Int -> Event -> ShowS)
-> (Event -> String) -> ([Event] -> ShowS) -> Show Event
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Event] -> ShowS
$cshowList :: [Event] -> ShowS
show :: Event -> String
$cshow :: Event -> String
showsPrec :: Int -> Event -> ShowS
$cshowsPrec :: Int -> Event -> ShowS
Show)