{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE TypeFamilies #-}

-- | Abstract sockets connected to 'Box'es.
module Box.Socket.Types
  ( PostSend (..),
    SocketStatus (..),
  )
where

import GHC.Generics (Generic)

-- | Whether to stay open after an emitter ends or send a close after a delay in seconds.
data PostSend = StayOpen | CloseAfter Double deriving (forall x. Rep PostSend x -> PostSend
forall x. PostSend -> Rep PostSend x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PostSend x -> PostSend
$cfrom :: forall x. PostSend -> Rep PostSend x
Generic, PostSend -> PostSend -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostSend -> PostSend -> Bool
$c/= :: PostSend -> PostSend -> Bool
== :: PostSend -> PostSend -> Bool
$c== :: PostSend -> PostSend -> Bool
Eq, Int -> PostSend -> ShowS
[PostSend] -> ShowS
PostSend -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostSend] -> ShowS
$cshowList :: [PostSend] -> ShowS
show :: PostSend -> String
$cshow :: PostSend -> String
showsPrec :: Int -> PostSend -> ShowS
$cshowsPrec :: Int -> PostSend -> ShowS
Show)

-- | Whether a socket remains open or closed after an action finishes.
data SocketStatus = SocketOpen | SocketClosed | SocketBroken deriving (forall x. Rep SocketStatus x -> SocketStatus
forall x. SocketStatus -> Rep SocketStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SocketStatus x -> SocketStatus
$cfrom :: forall x. SocketStatus -> Rep SocketStatus x
Generic, SocketStatus -> SocketStatus -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SocketStatus -> SocketStatus -> Bool
$c/= :: SocketStatus -> SocketStatus -> Bool
== :: SocketStatus -> SocketStatus -> Bool
$c== :: SocketStatus -> SocketStatus -> Bool
Eq, Int -> SocketStatus -> ShowS
[SocketStatus] -> ShowS
SocketStatus -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SocketStatus] -> ShowS
$cshowList :: [SocketStatus] -> ShowS
show :: SocketStatus -> String
$cshow :: SocketStatus -> String
showsPrec :: Int -> SocketStatus -> ShowS
$cshowsPrec :: Int -> SocketStatus -> ShowS
Show)