calamity-0.8.0.0: A library for writing discord bots in haskell
Safe HaskellSafe-Inferred
LanguageHaskell2010

Calamity.Internal.Utils

Description

Internal utilities and instances

Synopsis

Documentation

whileMFinalIO :: Member (Final IO) r => Sem r Bool -> Sem r () Source #

Like whileM, but stateful effects are not preserved to mitigate memory leaks

This means Polysemy.Error won't work to break the loop, etc. Instead, Error/Alternative will just result in the loop quitting.

untilJustFinalIO :: Member (Final IO) r => Sem r (Maybe a) -> Sem r a Source #

Like untilJust, but stateful effects are not preserved to mitigate memory leaks

This means Polysemy.Error won't work to break the loop, etc. Instead, Error/Alternative will just result in another loop.

whenJust :: Applicative m => Maybe a -> (a -> m ()) -> m () Source #

whenM :: Monad m => m Bool -> m () -> m () Source #

unlessM :: Monad m => m Bool -> m () -> m () Source #

(<<$>>) :: (Functor f, Functor g) => (a -> b) -> f (g a) -> f (g b) infixl 4 Source #

(<<*>>) :: (Applicative f, Applicative g) => f (g (a -> b)) -> f (g a) -> f (g b) infixl 4 Source #

(<.>) :: Functor f => (a -> b) -> (c -> f a) -> c -> f b infixl 4 Source #

(.?=) :: (ToJSON v, KeyValue kv) => Key -> Maybe v -> Maybe kv Source #

(.=) :: (ToJSON v, KeyValue kv) => Key -> v -> Maybe kv Source #

debug :: Member LogEff r => Text -> Sem r () Source #

info :: Member LogEff r => Text -> Sem r () Source #

error :: Member LogEff r => Text -> Sem r () Source #

swap :: (a, b) -> (b, a) Source #

newtype DefaultingMap k v Source #

Constructors

DefaultingMap 

Fields

Instances

Instances details
Default (DefaultingMap k v) Source # 
Instance details

Defined in Calamity.Internal.Utils

Methods

def :: DefaultingMap k v #

data MaybeNull a Source #

An alternative Maybe type that allows us to distinguish between parsed json fields that were null, and fields that didn't exist.

Constructors

WasNull 
NotNull a 

Instances

Instances details
FromJSON a => FromJSON (MaybeNull a) Source # 
Instance details

Defined in Calamity.Internal.Utils

ToJSON a => ToJSON (MaybeNull a) Source # 
Instance details

Defined in Calamity.Internal.Utils

Show a => Show (MaybeNull a) Source # 
Instance details

Defined in Calamity.Internal.Utils

newtype CalamityToJSON a Source #

Constructors

CalamityToJSON a 

class CalamityToJSON' a where Source #

Methods

toPairs :: KeyValue kv => a -> [Maybe kv] Source #

Instances

Instances details
CalamityToJSON' IdentifyData Source # 
Instance details

Defined in Calamity.Gateway.Types

Methods

toPairs :: KeyValue kv => IdentifyData -> [Maybe kv] Source #

CalamityToJSON' IdentifyProps Source # 
Instance details

Defined in Calamity.Gateway.Types

Methods

toPairs :: KeyValue kv => IdentifyProps -> [Maybe kv] Source #

CalamityToJSON' RequestGuildMembersData Source # 
Instance details

Defined in Calamity.Gateway.Types

CalamityToJSON' ResumeData Source # 
Instance details

Defined in Calamity.Gateway.Types

Methods

toPairs :: KeyValue kv => ResumeData -> [Maybe kv] Source #

CalamityToJSON' StatusUpdateData Source # 
Instance details

Defined in Calamity.Gateway.Types

Methods

toPairs :: KeyValue kv => StatusUpdateData -> [Maybe kv] Source #

CalamityToJSON' AllowedMentions Source # 
Instance details

Defined in Calamity.HTTP.Channel

Methods

toPairs :: KeyValue kv => AllowedMentions -> [Maybe kv] Source #

CalamityToJSON' ChannelMessagesFilter Source # 
Instance details

Defined in Calamity.HTTP.Channel

CalamityToJSON' ChannelUpdate Source # 
Instance details

Defined in Calamity.HTTP.Channel

Methods

toPairs :: KeyValue kv => ChannelUpdate -> [Maybe kv] Source #

CalamityToJSON' CreateChannelInviteOptions Source # 
Instance details

Defined in Calamity.HTTP.Channel

CalamityToJSON' GroupDMAddRecipientOptions Source # 
Instance details

Defined in Calamity.HTTP.Channel

CalamityToJSON' CreateGuildEmojiOptions Source # 
Instance details

Defined in Calamity.HTTP.Emoji

CalamityToJSON' ModifyGuildEmojiOptions Source # 
Instance details

Defined in Calamity.HTTP.Emoji

CalamityToJSON' AddGuildMemberData Source # 
Instance details

Defined in Calamity.HTTP.Guild

CalamityToJSON' ChannelCreateData Source # 
Instance details

Defined in Calamity.HTTP.Guild

CalamityToJSON' ChannelPosition Source # 
Instance details

Defined in Calamity.HTTP.Guild

Methods

toPairs :: KeyValue kv => ChannelPosition -> [Maybe kv] Source #

CalamityToJSON' CreateGuildData Source # 
Instance details

Defined in Calamity.HTTP.Guild

Methods

toPairs :: KeyValue kv => CreateGuildData -> [Maybe kv] Source #

CalamityToJSON' ListMembersOptions Source # 
Instance details

Defined in Calamity.HTTP.Guild

CalamityToJSON' ModifyGuildData Source # 
Instance details

Defined in Calamity.HTTP.Guild

Methods

toPairs :: KeyValue kv => ModifyGuildData -> [Maybe kv] Source #

CalamityToJSON' ModifyGuildRolePositionsData Source # 
Instance details

Defined in Calamity.HTTP.Guild

CalamityToJSON' InteractionCallbackAutocomplete Source # 
Instance details

Defined in Calamity.HTTP.Interaction

CalamityToJSON' InteractionCallbackAutocompleteChoice Source # 
Instance details

Defined in Calamity.HTTP.Interaction

CalamityToJSON' InteractionCallbackModal Source # 
Instance details

Defined in Calamity.HTTP.Interaction

CalamityToJSON' ModifyUserData Source # 
Instance details

Defined in Calamity.HTTP.User

Methods

toPairs :: KeyValue kv => ModifyUserData -> [Maybe kv] Source #

CalamityToJSON' CreateWebhookData Source # 
Instance details

Defined in Calamity.HTTP.Webhook

CalamityToJSON' ModifyWebhookData Source # 
Instance details

Defined in Calamity.HTTP.Webhook

CalamityToJSON' Button Source # 
Instance details

Defined in Calamity.Types.Model.Channel.Component

Methods

toPairs :: KeyValue kv => Button -> [Maybe kv] Source #

CalamityToJSON' LinkButton Source # 
Instance details

Defined in Calamity.Types.Model.Channel.Component

Methods

toPairs :: KeyValue kv => LinkButton -> [Maybe kv] Source #

CalamityToJSON' Select Source # 
Instance details

Defined in Calamity.Types.Model.Channel.Component

Methods

toPairs :: KeyValue kv => Select -> [Maybe kv] Source #

CalamityToJSON' SelectOption Source # 
Instance details

Defined in Calamity.Types.Model.Channel.Component

Methods

toPairs :: KeyValue kv => SelectOption -> [Maybe kv] Source #

CalamityToJSON' TextInput Source # 
Instance details

Defined in Calamity.Types.Model.Channel.Component

Methods

toPairs :: KeyValue kv => TextInput -> [Maybe kv] Source #

CalamityToJSON' Embed Source # 
Instance details

Defined in Calamity.Types.Model.Channel.Embed

Methods

toPairs :: KeyValue kv => Embed -> [Maybe kv] Source #

CalamityToJSON' EmbedAuthor Source # 
Instance details

Defined in Calamity.Types.Model.Channel.Embed

Methods

toPairs :: KeyValue kv => EmbedAuthor -> [Maybe kv] Source #

CalamityToJSON' EmbedField Source # 
Instance details

Defined in Calamity.Types.Model.Channel.Embed

Methods

toPairs :: KeyValue kv => EmbedField -> [Maybe kv] Source #

CalamityToJSON' EmbedFooter Source # 
Instance details

Defined in Calamity.Types.Model.Channel.Embed

Methods

toPairs :: KeyValue kv => EmbedFooter -> [Maybe kv] Source #

CalamityToJSON' EmbedImage Source # 
Instance details

Defined in Calamity.Types.Model.Channel.Embed

Methods

toPairs :: KeyValue kv => EmbedImage -> [Maybe kv] Source #

CalamityToJSON' EmbedProvider Source # 
Instance details

Defined in Calamity.Types.Model.Channel.Embed

Methods

toPairs :: KeyValue kv => EmbedProvider -> [Maybe kv] Source #

CalamityToJSON' EmbedThumbnail Source # 
Instance details

Defined in Calamity.Types.Model.Channel.Embed

Methods

toPairs :: KeyValue kv => EmbedThumbnail -> [Maybe kv] Source #

CalamityToJSON' EmbedVideo Source # 
Instance details

Defined in Calamity.Types.Model.Channel.Embed

Methods

toPairs :: KeyValue kv => EmbedVideo -> [Maybe kv] Source #

CalamityToJSON' MessageReference Source # 
Instance details

Defined in Calamity.Types.Model.Channel.Message

Methods

toPairs :: KeyValue kv => MessageReference -> [Maybe kv] Source #

CalamityToJSON' Reaction Source # 
Instance details

Defined in Calamity.Types.Model.Channel.Reaction

Methods

toPairs :: KeyValue kv => Reaction -> [Maybe kv] Source #

CalamityToJSON' Overwrite Source # 
Instance details

Defined in Calamity.Types.Model.Guild.Overwrite

Methods

toPairs :: KeyValue kv => Overwrite -> [Maybe kv] Source #

CalamityToJSON' Role Source # 
Instance details

Defined in Calamity.Types.Model.Guild.Role

Methods

toPairs :: KeyValue kv => Role -> [Maybe kv] Source #

CalamityToJSON' UnavailableGuild Source # 
Instance details

Defined in Calamity.Types.Model.Guild.UnavailableGuild

Methods

toPairs :: KeyValue kv => UnavailableGuild -> [Maybe kv] Source #

CalamityToJSON' Activity Source # 
Instance details

Defined in Calamity.Types.Model.Presence.Activity

Methods

toPairs :: KeyValue kv => Activity -> [Maybe kv] Source #

CalamityToJSON' ActivityAssets Source # 
Instance details

Defined in Calamity.Types.Model.Presence.Activity

Methods

toPairs :: KeyValue kv => ActivityAssets -> [Maybe kv] Source #

CalamityToJSON' ActivityParty Source # 
Instance details

Defined in Calamity.Types.Model.Presence.Activity

Methods

toPairs :: KeyValue kv => ActivityParty -> [Maybe kv] Source #

CalamityToJSON' ActivitySecrets Source # 
Instance details

Defined in Calamity.Types.Model.Presence.Activity

Methods

toPairs :: KeyValue kv => ActivitySecrets -> [Maybe kv] Source #

CalamityToJSON' ActivityTimestamps Source # 
Instance details

Defined in Calamity.Types.Model.Presence.Activity

CalamityToJSON' ClientStatus Source # 
Instance details

Defined in Calamity.Types.Model.Presence.Presence

Methods

toPairs :: KeyValue kv => ClientStatus -> [Maybe kv] Source #

CalamityToJSON' VoiceRegion Source # 
Instance details

Defined in Calamity.Types.Model.Voice.VoiceRegion

Methods

toPairs :: KeyValue kv => VoiceRegion -> [Maybe kv] Source #

CalamityToJSON' VoiceState Source # 
Instance details

Defined in Calamity.Types.Model.Voice.VoiceState

Methods

toPairs :: KeyValue kv => VoiceState -> [Maybe kv] Source #

CalamityToJSON' (Partial Channel) Source # 
Instance details

Defined in Calamity.Types.Model.Channel

Methods

toPairs :: KeyValue kv => Partial Channel -> [Maybe kv] Source #

CalamityToJSON' (Partial Emoji) Source # 
Instance details

Defined in Calamity.Types.Model.Guild.Emoji

Methods

toPairs :: KeyValue kv => Partial Emoji -> [Maybe kv] Source #

CalamityToJSON' (Partial Guild) Source # 
Instance details

Defined in Calamity.Types.Model.Guild.Guild

Methods

toPairs :: KeyValue kv => Partial Guild -> [Maybe kv] Source #