module TDLib.Types.Common where import Control.Applicative import Data.Aeson -- | Tagged union that parses to either a or b data a ∪ b = Inl a | Inr b deriving (Int -> (a ∪ b) -> ShowS [a ∪ b] -> ShowS (a ∪ b) -> String (Int -> (a ∪ b) -> ShowS) -> ((a ∪ b) -> String) -> ([a ∪ b] -> ShowS) -> Show (a ∪ b) forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a forall a b. (Show a, Show b) => Int -> (a ∪ b) -> ShowS forall a b. (Show a, Show b) => [a ∪ b] -> ShowS forall a b. (Show a, Show b) => (a ∪ b) -> String showList :: [a ∪ b] -> ShowS $cshowList :: forall a b. (Show a, Show b) => [a ∪ b] -> ShowS show :: (a ∪ b) -> String $cshow :: forall a b. (Show a, Show b) => (a ∪ b) -> String showsPrec :: Int -> (a ∪ b) -> ShowS $cshowsPrec :: forall a b. (Show a, Show b) => Int -> (a ∪ b) -> ShowS Show, (a ∪ b) -> (a ∪ b) -> Bool ((a ∪ b) -> (a ∪ b) -> Bool) -> ((a ∪ b) -> (a ∪ b) -> Bool) -> Eq (a ∪ b) forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a forall a b. (Eq a, Eq b) => (a ∪ b) -> (a ∪ b) -> Bool /= :: (a ∪ b) -> (a ∪ b) -> Bool $c/= :: forall a b. (Eq a, Eq b) => (a ∪ b) -> (a ∪ b) -> Bool == :: (a ∪ b) -> (a ∪ b) -> Bool $c== :: forall a b. (Eq a, Eq b) => (a ∪ b) -> (a ∪ b) -> Bool Eq) instance (FromJSON a, FromJSON b) => FromJSON (a ∪ b) where parseJSON :: Value -> Parser (a ∪ b) parseJSON a :: Value a = a -> a ∪ b forall a b. a -> a ∪ b Inl (a -> a ∪ b) -> Parser a -> Parser (a ∪ b) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Value -> Parser a forall a. FromJSON a => Value -> Parser a parseJSON Value a Parser (a ∪ b) -> Parser (a ∪ b) -> Parser (a ∪ b) forall (f :: * -> *) a. Alternative f => f a -> f a -> f a <|> b -> a ∪ b forall a b. b -> a ∪ b Inr (b -> a ∪ b) -> Parser b -> Parser (a ∪ b) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Value -> Parser b forall a. FromJSON a => Value -> Parser a parseJSON Value a -- | Logging verbosity data Verbosity = Fatal | Error | Warning | Info | Debug | Verbose deriving (Int -> Verbosity -> ShowS [Verbosity] -> ShowS Verbosity -> String (Int -> Verbosity -> ShowS) -> (Verbosity -> String) -> ([Verbosity] -> ShowS) -> Show Verbosity forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [Verbosity] -> ShowS $cshowList :: [Verbosity] -> ShowS show :: Verbosity -> String $cshow :: Verbosity -> String showsPrec :: Int -> Verbosity -> ShowS $cshowsPrec :: Int -> Verbosity -> ShowS Show, Verbosity -> Verbosity -> Bool (Verbosity -> Verbosity -> Bool) -> (Verbosity -> Verbosity -> Bool) -> Eq Verbosity forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: Verbosity -> Verbosity -> Bool $c/= :: Verbosity -> Verbosity -> Bool == :: Verbosity -> Verbosity -> Bool $c== :: Verbosity -> Verbosity -> Bool Eq, Int -> Verbosity Verbosity -> Int Verbosity -> [Verbosity] Verbosity -> Verbosity Verbosity -> Verbosity -> [Verbosity] Verbosity -> Verbosity -> Verbosity -> [Verbosity] (Verbosity -> Verbosity) -> (Verbosity -> Verbosity) -> (Int -> Verbosity) -> (Verbosity -> Int) -> (Verbosity -> [Verbosity]) -> (Verbosity -> Verbosity -> [Verbosity]) -> (Verbosity -> Verbosity -> [Verbosity]) -> (Verbosity -> Verbosity -> Verbosity -> [Verbosity]) -> Enum Verbosity forall a. (a -> a) -> (a -> a) -> (Int -> a) -> (a -> Int) -> (a -> [a]) -> (a -> a -> [a]) -> (a -> a -> [a]) -> (a -> a -> a -> [a]) -> Enum a enumFromThenTo :: Verbosity -> Verbosity -> Verbosity -> [Verbosity] $cenumFromThenTo :: Verbosity -> Verbosity -> Verbosity -> [Verbosity] enumFromTo :: Verbosity -> Verbosity -> [Verbosity] $cenumFromTo :: Verbosity -> Verbosity -> [Verbosity] enumFromThen :: Verbosity -> Verbosity -> [Verbosity] $cenumFromThen :: Verbosity -> Verbosity -> [Verbosity] enumFrom :: Verbosity -> [Verbosity] $cenumFrom :: Verbosity -> [Verbosity] fromEnum :: Verbosity -> Int $cfromEnum :: Verbosity -> Int toEnum :: Int -> Verbosity $ctoEnum :: Int -> Verbosity pred :: Verbosity -> Verbosity $cpred :: Verbosity -> Verbosity succ :: Verbosity -> Verbosity $csucc :: Verbosity -> Verbosity Enum)