calamity-0.4.0.0: A library for writing discord bots in haskell
Safe HaskellNone
LanguageHaskell2010

Calamity.Internal.Utils

Description

Internal utilities and instances

Synopsis

Documentation

whileMFinalIO :: 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 #

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
Show a => Show (MaybeNull a) Source # 
Instance details

Defined in Calamity.Internal.Utils

Generic (MaybeNull a) Source # 
Instance details

Defined in Calamity.Internal.Utils

Associated Types

type Rep (MaybeNull a) :: Type -> Type #

Methods

from :: MaybeNull a -> Rep (MaybeNull a) x #

to :: Rep (MaybeNull a) x -> MaybeNull a #

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

Defined in Calamity.Internal.Utils

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

Defined in Calamity.Internal.Utils

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

Defined in Calamity.Internal.Utils

type Rep (MaybeNull a) Source # 
Instance details

Defined in Calamity.Internal.Utils

type Rep (MaybeNull a) = D1 ('MetaData "MaybeNull" "Calamity.Internal.Utils" "calamity-0.4.0.0-inplace" 'False) (C1 ('MetaCons "WasNull" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NotNull" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 a)))