diff options
Diffstat (limited to 'deps/discord-haskell/src/Discord/Handle.hs')
| -rw-r--r-- | deps/discord-haskell/src/Discord/Handle.hs | 38 |
1 files changed, 38 insertions, 0 deletions
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 + } |
