From dcef0b65069fb38fd0f6c4382353167f603ebff1 Mon Sep 17 00:00:00 2001 From: LLLL Colonq Date: Thu, 16 Nov 2023 19:06:43 -0500 Subject: Initial commit --- deps/discord-haskell/src/Discord/Handle.hs | 38 ++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 deps/discord-haskell/src/Discord/Handle.hs (limited to 'deps/discord-haskell/src/Discord/Handle.hs') diff --git a/deps/discord-haskell/src/Discord/Handle.hs b/deps/discord-haskell/src/Discord/Handle.hs new file mode 100644 index 0000000..48d6641 --- /dev/null +++ b/deps/discord-haskell/src/Discord/Handle.hs @@ -0,0 +1,38 @@ +-- | The Discord Handle. Holds all the information related to the connection. +module Discord.Handle + ( DiscordHandle(..) + , HandleThreadId(..) + ) where + +import Control.Concurrent (ThreadId, Chan, MVar) +import qualified Data.Text as T + +import Discord.Internal.Rest (RestChanHandle(..)) +import Discord.Internal.Gateway (GatewayHandle(..), CacheHandle(..)) + +-- | Thread Ids marked by what type they are +data HandleThreadId + = -- | A Rest API thread + HandleThreadIdRest ThreadId + | -- | A cache thread + HandleThreadIdCache ThreadId + | -- | A logger thread + HandleThreadIdLogger ThreadId + | -- | A gateway thread + HandleThreadIdGateway ThreadId + +-- | The main Handle structure +data DiscordHandle = DiscordHandle + { -- | Handle to the Rest loop + discordHandleRestChan :: RestChanHandle + , -- | Handle to the Websocket gateway event loop + discordHandleGateway :: GatewayHandle + , -- | Handle to the cache + discordHandleCache :: CacheHandle + , -- | List of the threads currently in use by the library + discordHandleThreads :: [HandleThreadId] + , -- | `Chan` used to send messages to the internal logger + discordHandleLog :: Chan T.Text + , -- | `MVar` containing a description of the latest library error + discordHandleLibraryError :: MVar T.Text + } -- cgit v1.2.3