    {-# LANGUAGE CPP #-}
    {-# LANGUAGE DeriveGeneric #-}
    {-# LANGUAGE FlexibleInstances #-}
    {-# LANGUAGE GeneralizedNewtypeDeriving #-}
    {-# LANGUAGE IncoherentInstances #-}
    {-# LANGUAGE ScopedTypeVariables #-}
    {-# LANGUAGE TemplateHaskell #-}

    -- Copyright (C) 2009-2012 John Millikin <john@john-millikin.com>
    -- it under the terms of the GNU General Public License as published by
    -- the Free Software Foundation, either version 3 of the License, or
    -- any later version.
    --
    -- This program is distributed in the hope that it will be useful,
    -- but WITHOUT ANY WARRANTY; without even the implied warranty of
    -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    -- GNU General Public License for more details.
    --
    -- You should have received a copy of the GNU General Public License
    -- along with this program.  If not, see <http://www.gnu.org/licenses/>.

    module DBus.Internal.Types where

    import           Control.DeepSeq
    import           Control.Monad (liftM, when, (>=>))
    import           Control.Monad.Catch
    import qualified Data.ByteString as BS
    import qualified Data.ByteString.Char8 as BS8
    import qualified Data.ByteString.Lazy as BL
    import           Data.Char (ord)
    import           Data.Coerce
    import           Data.Int
    import           Data.List (intercalate)
    import           Data.List.Split (splitOn)
    import qualified Data.Map
    import           Data.Map (Map)
    import qualified Data.String
    import qualified Data.Text
    import           Data.Text (Text)
    import qualified Data.Text.Lazy
    import           Data.Typeable (Typeable, Proxy(..))
    import qualified Data.Vector
    import           Data.Vector (Vector)
    import           Data.Word
    import           GHC.Generics
    import qualified Language.Haskell.TH.Lift as THL
    import           System.Posix.Types (Fd)
    import           Text.ParserCombinators.Parsec ((<|>), oneOf)
    import qualified Text.ParserCombinators.Parsec as Parsec

    data Type
        = TypeBoolean
        | TypeWord8
        | TypeWord16
        | TypeWord32
        | TypeWord64
        | TypeInt16
        | TypeInt32
        | TypeInt64
        | TypeDouble
        | TypeUnixFd
        | TypeString
        | TypeSignature
        | TypeObjectPath
        | TypeVariant
        | TypeArray Type
        | TypeDictionary Type Type
        | TypeStructure [Type]
        deriving (Type -> Type -> Bool
    (Type -> Type -> Bool) -> (Type -> Type -> Bool) -> Eq Type
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Type -> Type -> Bool
    == :: Type -> Type -> Bool
    $c/= :: Type -> Type -> Bool
    /= :: Type -> Type -> Bool
    Eq, Eq Type
    Eq Type =>
    (Type -> Type -> Ordering)
    -> (Type -> Type -> Bool)
    -> (Type -> Type -> Bool)
    -> (Type -> Type -> Bool)
    -> (Type -> Type -> Bool)
    -> (Type -> Type -> Type)
    -> (Type -> Type -> Type)
    -> Ord Type
    Type -> Type -> Bool
    Type -> Type -> Ordering
    Type -> Type -> Type
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: Type -> Type -> Ordering
    compare :: Type -> Type -> Ordering
    $c< :: Type -> Type -> Bool
    < :: Type -> Type -> Bool
    $c<= :: Type -> Type -> Bool
    <= :: Type -> Type -> Bool
    $c> :: Type -> Type -> Bool
    > :: Type -> Type -> Bool
    $c>= :: Type -> Type -> Bool
    >= :: Type -> Type -> Bool
    $cmax :: Type -> Type -> Type
    max :: Type -> Type -> Type
    $cmin :: Type -> Type -> Type
    min :: Type -> Type -> Type
    Ord, (forall x. Type -> Rep Type x)
    -> (forall x. Rep Type x -> Type) -> Generic Type
    forall x. Rep Type x -> Type
    forall x. Type -> Rep Type x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cfrom :: forall x. Type -> Rep Type x
    from :: forall x. Type -> Rep Type x
    $cto :: forall x. Rep Type x -> Type
    to :: forall x. Rep Type x -> Type
    Generic)

    instance NFData Type

    instance Show Type where
        showsPrec :: Int -> Type -> ShowS
    showsPrec Int
    d = String -> ShowS
    showString (String -> ShowS) -> (Type -> String) -> Type -> ShowS
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Bool -> Type -> String
    showType (Int
    d Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    > Int
    10)

    showType :: Bool -> Type -> String
    showType :: Bool -> Type -> String
    showType Bool
    paren Type
    t = case Type
    t of
        Type
    TypeBoolean -> String
    "Bool"
        Type
    TypeWord8 -> String
    "Word8"
        Type
    TypeWord16 -> String
    "Word16"
        Type
    TypeWord32 -> String
    "Word32"
        Type
    TypeWord64 -> String
    "Word64"
        Type
    TypeInt16 -> String
    "Int16"
        Type
    TypeInt32 -> String
    "Int32"
        Type
    TypeInt64 -> String
    "Int64"
        Type
    TypeDouble -> String
    "Double"
        Type
    TypeUnixFd -> String
    "UnixFd"
        Type
    TypeString -> String
    "String"
        Type
    TypeSignature -> String
    "Signature"
        Type
    TypeObjectPath -> String
    "ObjectPath"
        Type
    TypeVariant -> String
    "Variant"
        TypeArray Type
    t' -> [String] -> String
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat [String
    "[", Type -> String
    forall a. Show a => a -> String
    show Type
    t', String
    "]"]
        TypeDictionary Type
    kt Type
    vt -> Bool -> ShowS -> ShowS
    showParen Bool
    paren (
                                String -> ShowS
    showString String
    "Dict " ShowS -> ShowS -> ShowS
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    .
                                Type -> ShowS
    forall a. Show a => a -> ShowS
    shows Type
    kt ShowS -> ShowS -> ShowS
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    .
                                String -> ShowS
    showString String
    " " ShowS -> ShowS -> ShowS
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    .
                                Int -> Type -> ShowS
    forall a. Show a => Int -> a -> ShowS
    showsPrec Int
    11 Type
    vt) String
    ""
        TypeStructure [Type]
    ts -> [String] -> String
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat
            [String
    "(", String -> [String] -> String
    forall a. [a] -> [[a]] -> [a]
    intercalate String
    ", " ((Type -> String) -> [Type] -> [String]
    forall a b. (a -> b) -> [a] -> [b]
    map Type -> String
    forall a. Show a => a -> String
    show [Type]
    ts), String
    ")"]

    -- | A signature is a list of D-Bus types, obeying some basic rules of
    -- validity.
    --
    -- The rules of signature validity are complex: see
    -- <http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-signatures>
    -- for details.
    newtype Signature = Signature [Type]
        deriving (Signature -> Signature -> Bool
    (Signature -> Signature -> Bool)
    -> (Signature -> Signature -> Bool) -> Eq Signature
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Signature -> Signature -> Bool
    == :: Signature -> Signature -> Bool
    $c/= :: Signature -> Signature -> Bool
    /= :: Signature -> Signature -> Bool
    Eq, Eq Signature
    Eq Signature =>
    (Signature -> Signature -> Ordering)
    -> (Signature -> Signature -> Bool)
    -> (Signature -> Signature -> Bool)
    -> (Signature -> Signature -> Bool)
    -> (Signature -> Signature -> Bool)
    -> (Signature -> Signature -> Signature)
    -> (Signature -> Signature -> Signature)
    -> Ord Signature
    Signature -> Signature -> Bool
    Signature -> Signature -> Ordering
    Signature -> Signature -> Signature
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: Signature -> Signature -> Ordering
    compare :: Signature -> Signature -> Ordering
    $c< :: Signature -> Signature -> Bool
    < :: Signature -> Signature -> Bool
    $c<= :: Signature -> Signature -> Bool
    <= :: Signature -> Signature -> Bool
    $c> :: Signature -> Signature -> Bool
    > :: Signature -> Signature -> Bool
    $c>= :: Signature -> Signature -> Bool
    >= :: Signature -> Signature -> Bool
    $cmax :: Signature -> Signature -> Signature
    max :: Signature -> Signature -> Signature
    $cmin :: Signature -> Signature -> Signature
    min :: Signature -> Signature -> Signature
    Ord, Signature -> ()
    (Signature -> ()) -> NFData Signature
    forall a. (a -> ()) -> NFData a
    $crnf :: Signature -> ()
    rnf :: Signature -> ()
    NFData)

    -- | Get the list of types in a signature. The inverse of 'signature'.
    signatureTypes :: Signature -> [Type]
    signatureTypes :: Signature -> [Type]
    signatureTypes (Signature [Type]
    types) = [Type]
    types

    instance Show Signature where
        showsPrec :: Int -> Signature -> ShowS
    showsPrec Int
    d Signature
    sig = Bool -> ShowS -> ShowS
    showParen (Int
    d Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    > Int
    10) (ShowS -> ShowS) -> ShowS -> ShowS
    forall a b. (a -> b) -> a -> b
    $
            String -> ShowS
    showString String
    "Signature " ShowS -> ShowS -> ShowS
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    .
            String -> ShowS
    forall a. Show a => a -> ShowS
    shows (Signature -> String
    formatSignature Signature
    sig)

    -- | Convert a signature into a signature string. The inverse of
    -- 'parseSignature'.
    formatSignature :: Signature -> String
    formatSignature :: Signature -> String
    formatSignature = (Type -> String) -> [Type] -> String
    forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
    concatMap Type -> String
    typeCode ([Type] -> String) -> (Signature -> [Type]) -> Signature -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Signature -> [Type]
    signatureTypes

    typeCode :: Type -> String
    typeCode :: Type -> String
    typeCode Type
    TypeBoolean    = String
    "b"
    typeCode Type
    TypeWord8      = String
    "y"
    typeCode Type
    TypeWord16     = String
    "q"
    typeCode Type
    TypeWord32     = String
    "u"
    typeCode Type
    TypeWord64     = String
    "t"
    typeCode Type
    TypeInt16      = String
    "n"
    typeCode Type
    TypeInt32      = String
    "i"
    typeCode Type
    TypeInt64      = String
    "x"
    typeCode Type
    TypeDouble     = String
    "d"
    typeCode Type
    TypeUnixFd     = String
    "h"
    typeCode Type
    TypeString     = String
    "s"
    typeCode Type
    TypeSignature  = String
    "g"
    typeCode Type
    TypeObjectPath = String
    "o"
    typeCode Type
    TypeVariant    = String
    "v"
    typeCode (TypeArray Type
    t)  = Char
    'a' Char -> ShowS
    forall a. a -> [a] -> [a]
    : Type -> String
    typeCode Type
    t
    typeCode (TypeDictionary Type
    kt Type
    vt) = [String] -> String
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat
        [ String
    "a{", Type -> String
    typeCode Type
    kt , Type -> String
    typeCode Type
    vt, String
    "}"]

    typeCode (TypeStructure [Type]
    ts) = [String] -> String
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat
        [String
    "(", (Type -> String) -> [Type] -> String
    forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
    concatMap Type -> String
    typeCode [Type]
    ts, String
    ")"]

    instance Data.String.IsString Signature where
        fromString :: String -> Signature
    fromString = String -> (String -> Maybe Signature) -> String -> Signature
    forall a. String -> (String -> Maybe a) -> String -> a
    forceParse String
    "signature" String -> Maybe Signature
    forall (m :: * -> *). MonadThrow m => String -> m Signature
    parseSignature

    -- | Convert a list of types into a valid signature.
    --
    -- Throws if the given types are not a valid signature.
    signature :: MonadThrow m => [Type] -> m Signature
    signature :: forall (m :: * -> *). MonadThrow m => [Type] -> m Signature
    signature = [Type] -> m Signature
    forall (m :: * -> *). MonadThrow m => [Type] -> m Signature
    check where
        check :: [Type] -> m Signature
    check [Type]
    ts = if [Type] -> Int
    sumLen [Type]
    ts Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    > Int
    255
            then IOError -> m Signature
    forall e a. (HasCallStack, Exception e) => e -> m a
    forall (m :: * -> *) e a.
    (MonadThrow m, HasCallStack, Exception e) =>
    e -> m a
    throwM (IOError -> m Signature) -> IOError -> m Signature
    forall a b. (a -> b) -> a -> b
    $ String -> IOError
    userError String
    "invalid signature"
            else Signature -> m Signature
    forall a. a -> m a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure ([Type] -> Signature
    Signature [Type]
    ts)
        sumLen :: [Type] -> Int
        sumLen :: [Type] -> Int
    sumLen = [Int] -> Int
    forall a. Num a => [a] -> a
    forall (t :: * -> *) a. (Foldable t, Num a) => t a -> a
    sum ([Int] -> Int) -> ([Type] -> [Int]) -> [Type] -> Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Type -> Int) -> [Type] -> [Int]
    forall a b. (a -> b) -> [a] -> [b]
    map Type -> Int
    len

        len :: Type -> Int
    len (TypeArray Type
    t) = Int
    1 Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Type -> Int
    len Type
    t
        len (TypeDictionary Type
    kt Type
    vt)
            | Type -> Bool
    typeIsAtomic Type
    kt = Int
    3 Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Type -> Int
    len Type
    kt Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Type -> Int
    len Type
    vt
            | Bool
    otherwise = Int
    256
        len (TypeStructure []) = Int
    256
        len (TypeStructure [Type]
    ts) = Int
    2 Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + [Type] -> Int
    sumLen [Type]
    ts
        len Type
    _ = Int
    1

        typeIsAtomic :: Type -> Bool
    typeIsAtomic Type
    TypeVariant = Bool
    False
        typeIsAtomic TypeArray{} = Bool
    False
        typeIsAtomic TypeDictionary{} = Bool
    False
        typeIsAtomic TypeStructure{} = Bool
    False
        typeIsAtomic Type
    _ = Bool
    True

    -- | Convert a list of types into a valid signature.
    --
    -- Throws an exception if the given types are not a valid signature.
    signature_ :: [Type] -> Signature
    signature_ :: [Type] -> Signature
    signature_ [Type]
    ts = case [Type] -> Maybe Signature
    forall (m :: * -> *). MonadThrow m => [Type] -> m Signature
    signature [Type]
    ts of
        Just Signature
    sig -> Signature
    sig
        Maybe Signature
    Nothing -> String -> Signature
    forall a. HasCallStack => String -> a
    error (String
    "invalid signature: " String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ [Type] -> String
    forall a. Show a => a -> String
    show [Type]
    ts)

    -- | Parse a signature string into a valid signature.
    --
    -- Throws if the given string is not a valid signature.
    parseSignature :: MonadThrow m => String -> m Signature
    parseSignature :: forall (m :: * -> *). MonadThrow m => String -> m Signature
    parseSignature String
    s = do
        Bool -> m () -> m ()
    forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
    when (String -> Int
    forall a. [a] -> Int
    forall (t :: * -> *) a. Foldable t => t a -> Int
    length String
    s Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    > Int
    255) (m () -> m ()) -> m () -> m ()
    forall a b. (a -> b) -> a -> b
    $ IOError -> m ()
    forall e a. (HasCallStack, Exception e) => e -> m a
    forall (m :: * -> *) e a.
    (MonadThrow m, HasCallStack, Exception e) =>
    e -> m a
    throwM (IOError -> m ()) -> IOError -> m ()
    forall a b. (a -> b) -> a -> b
    $ String -> IOError
    userError String
    "string too long"
        Bool -> m () -> m ()
    forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
    when ((Char -> Bool) -> String -> Bool
    forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
    any (\Char
    c -> Char -> Int
    ord Char
    c Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    > Int
    0x7F) String
    s) (m () -> m ()) -> m () -> m ()
    forall a b. (a -> b) -> a -> b
    $ IOError -> m ()
    forall e a. (HasCallStack, Exception e) => e -> m a
    forall (m :: * -> *) e a.
    (MonadThrow m, HasCallStack, Exception e) =>
    e -> m a
    throwM (IOError -> m ()) -> IOError -> m ()
    forall a b. (a -> b) -> a -> b
    $ String -> IOError
    userError String
    "invalid signature"
        ByteString -> m Signature
    forall (m :: * -> *). MonadThrow m => ByteString -> m Signature
    parseSignatureBytes (String -> ByteString
    BS8.pack String
    s)

    parseSignatureBytes :: MonadThrow m => BS.ByteString -> m Signature
    parseSignatureBytes :: forall (m :: * -> *). MonadThrow m => ByteString -> m Signature
    parseSignatureBytes ByteString
    bytes =
        case ByteString -> Int
    BS.length ByteString
    bytes of
            Int
    0 -> Signature -> m Signature
    forall a. a -> m a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure ([Type] -> Signature
    Signature [])
            Int
    1 -> ByteString -> m Signature
    forall (m :: * -> *). MonadThrow m => ByteString -> m Signature
    parseSigFast ByteString
    bytes
            Int
    len | Int
    len Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    <= Int
    255 -> ByteString -> m Signature
    forall (m :: * -> *). MonadThrow m => ByteString -> m Signature
    parseSigFull ByteString
    bytes
            Int
    _ -> IOError -> m Signature
    forall e a. (HasCallStack, Exception e) => e -> m a
    forall (m :: * -> *) e a.
    (MonadThrow m, HasCallStack, Exception e) =>
    e -> m a
    throwM (IOError -> m Signature) -> IOError -> m Signature
    forall a b. (a -> b) -> a -> b
    $ String -> IOError
    userError String
    "string too long"

    parseSigFast :: MonadThrow m => BS.ByteString -> m Signature
    parseSigFast :: forall (m :: * -> *). MonadThrow m => ByteString -> m Signature
    parseSigFast ByteString
    bytes =
        let byte :: Word8
    byte = HasCallStack => ByteString -> Word8
    ByteString -> Word8
    BS.head ByteString
    bytes
         in Int -> (Type -> m Signature) -> m Signature -> m Signature
    forall a. Int -> (Type -> a) -> a -> a
    parseAtom (Word8 -> Int
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral Word8
    byte)
                (\Type
    t -> Signature -> m Signature
    forall a. a -> m a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure ([Type] -> Signature
    Signature [Type
    t]))
                (case Word8
    byte of
                    Word8
    0x76 -> Signature -> m Signature
    forall a. a -> m a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure ([Type] -> Signature
    Signature [Type
    TypeVariant])
                    Word8
    _ -> IOError -> m Signature
    forall e a. (HasCallStack, Exception e) => e -> m a
    forall (m :: * -> *) e a.
    (MonadThrow m, HasCallStack, Exception e) =>
    e -> m a
    throwM (IOError -> m Signature) -> IOError -> m Signature
    forall a b. (a -> b) -> a -> b
    $ String -> IOError
    userError String
    "invalid signature")

    parseAtom :: Int -> (Type -> a) -> a -> a
    parseAtom :: forall a. Int -> (Type -> a) -> a -> a
    parseAtom Int
    byte Type -> a
    yes a
    no = case Int
    byte of
        Int
    0x62 -> Type -> a
    yes Type
    TypeBoolean
        Int
    0x6E -> Type -> a
    yes Type
    TypeInt16
        Int
    0x69 -> Type -> a
    yes Type
    TypeInt32
        Int
    0x78 -> Type -> a
    yes Type
    TypeInt64
        Int
    0x79 -> Type -> a
    yes Type
    TypeWord8
        Int
    0x71 -> Type -> a
    yes Type
    TypeWord16
        Int
    0x75 -> Type -> a
    yes Type
    TypeWord32
        Int
    0x74 -> Type -> a
    yes Type
    TypeWord64
        Int
    0x64 -> Type -> a
    yes Type
    TypeDouble
        Int
    0x68 -> Type -> a
    yes Type
    TypeUnixFd
        Int
    0x73 -> Type -> a
    yes Type
    TypeString
        Int
    0x67 -> Type -> a
    yes Type
    TypeSignature
        Int
    0x6F -> Type -> a
    yes Type
    TypeObjectPath
        Int
    _ -> a
    no
    {-# INLINE parseAtom #-}

    data SigParseError = SigParseError
        deriving (Int -> SigParseError -> ShowS
    [SigParseError] -> ShowS
    SigParseError -> String
    (Int -> SigParseError -> ShowS)
    -> (SigParseError -> String)
    -> ([SigParseError] -> ShowS)
    -> Show SigParseError
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> SigParseError -> ShowS
    showsPrec :: Int -> SigParseError -> ShowS
    $cshow :: SigParseError -> String
    show :: SigParseError -> String
    $cshowList :: [SigParseError] -> ShowS
    showList :: [SigParseError] -> ShowS
    Show, Typeable)

    instance Exception SigParseError

    peekWord8AsInt :: BS.ByteString -> Int -> Int
    peekWord8AsInt :: ByteString -> Int -> Int
    peekWord8AsInt ByteString
    str Int
    i = Word8 -> Int
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral (Word8 -> Int) -> Word8 -> Int
    forall a b. (a -> b) -> a -> b
    $ HasCallStack => ByteString -> Int -> Word8
    ByteString -> Int -> Word8
    BS.index ByteString
    str Int
    i

    parseSigFull :: MonadThrow m => BS.ByteString -> m Signature
    parseSigFull :: forall (m :: * -> *). MonadThrow m => ByteString -> m Signature
    parseSigFull ByteString
    bytes = [Type] -> Signature
    Signature ([Type] -> Signature) -> m [Type] -> m Signature
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> [Type] -> Int -> m [Type]
    mainLoop [] Int
    0
      where
        len :: Int
    len = ByteString -> Int
    BS.length ByteString
    bytes
        mainLoop :: [Type] -> Int -> m [Type]
    mainLoop [Type]
    acc Int
    ii | Int
    ii Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    >= Int
    len = [Type] -> m [Type]
    forall a. a -> m a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure ([Type] -> [Type]
    forall a. [a] -> [a]
    reverse [Type]
    acc)
        mainLoop [Type]
    acc Int
    ii = do
            let c :: Int
    c = ByteString -> Int -> Int
    peekWord8AsInt ByteString
    bytes Int
    ii
            let next :: Type -> m [Type]
    next Type
    t = [Type] -> Int -> m [Type]
    mainLoop (Type
    t Type -> [Type] -> [Type]
    forall a. a -> [a] -> [a]
    : [Type]
    acc) (Int
    ii Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    1)
            Int -> (Type -> m [Type]) -> m [Type] -> m [Type]
    forall a. Int -> (Type -> a) -> a -> a
    parseAtom Int
    c Type -> m [Type]
    next (m [Type] -> m [Type]) -> m [Type] -> m [Type]
    forall a b. (a -> b) -> a -> b
    $ case Int
    c of
                Int
    0x76 -> Type -> m [Type]
    next Type
    TypeVariant
                Int
    0x28 -> do -- '('
                    (ii', t) <- Int -> m (Int, Type)
    structure (Int
    ii Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    1)
                    mainLoop (t : acc) ii'
                Int
    0x61 -> do -- 'a'
                    (ii', t) <- Int -> m (Int, Type)
    array (Int
    ii Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    1)
                    mainLoop (t : acc) ii'
                Int
    _ -> SigParseError -> m [Type]
    forall e a. (HasCallStack, Exception e) => e -> m a
    forall (m :: * -> *) e a.
    (MonadThrow m, HasCallStack, Exception e) =>
    e -> m a
    throwM SigParseError
    SigParseError

        structure :: Int -> m (Int, Type)
    structure = [Type] -> Int -> m (Int, Type)
    loop [] where
            loop :: [Type] -> Int -> m (Int, Type)
    loop [Type]
    _ Int
    ii | Int
    ii Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    >= Int
    len = SigParseError -> m (Int, Type)
    forall e a. (HasCallStack, Exception e) => e -> m a
    forall (m :: * -> *) e a.
    (MonadThrow m, HasCallStack, Exception e) =>
    e -> m a
    throwM SigParseError
    SigParseError
            loop [Type]
    acc Int
    ii = do
                let c :: Int
    c = ByteString -> Int -> Int
    peekWord8AsInt ByteString
    bytes Int
    ii
                let next :: Type -> m (Int, Type)
    next Type
    t = [Type] -> Int -> m (Int, Type)
    loop (Type
    t Type -> [Type] -> [Type]
    forall a. a -> [a] -> [a]
    : [Type]
    acc) (Int
    ii Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    1)
                Int -> (Type -> m (Int, Type)) -> m (Int, Type) -> m (Int, Type)
    forall a. Int -> (Type -> a) -> a -> a
    parseAtom Int
    c Type -> m (Int, Type)
    next (m (Int, Type) -> m (Int, Type)) -> m (Int, Type) -> m (Int, Type)
    forall a b. (a -> b) -> a -> b
    $ case Int
    c of
                    Int
    0x76 -> Type -> m (Int, Type)
    next Type
    TypeVariant
                    Int
    0x28 -> do -- '('
                        (ii', t) <- Int -> m (Int, Type)
    structure (Int
    ii Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    1)
                        loop (t : acc) ii'
                    Int
    0x61 -> do -- 'a'
                        (ii', t) <- Int -> m (Int, Type)
    array (Int
    ii Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    1)
                        loop (t : acc) ii'
                    -- ')'
                    Int
    0x29 -> case [Type]
    acc of
                        [] -> SigParseError -> m (Int, Type)
    forall e a. (HasCallStack, Exception e) => e -> m a
    forall (m :: * -> *) e a.
    (MonadThrow m, HasCallStack, Exception e) =>
    e -> m a
    throwM SigParseError
    SigParseError
                        [Type]
    _ -> (Int, Type) -> m (Int, Type)
    forall a. a -> m a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (Int
    ii Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    1, [Type] -> Type
    TypeStructure ([Type] -> [Type]
    forall a. [a] -> [a]
    reverse [Type]
    acc))
                    Int
    _ -> SigParseError -> m (Int, Type)
    forall e a. (HasCallStack, Exception e) => e -> m a
    forall (m :: * -> *) e a.
    (MonadThrow m, HasCallStack, Exception e) =>
    e -> m a
    throwM SigParseError
    SigParseError

        array :: Int -> m (Int, Type)
    array Int
    ii | Int
    ii Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    >= Int
    len = SigParseError -> m (Int, Type)
    forall e a. (HasCallStack, Exception e) => e -> m a
    forall (m :: * -> *) e a.
    (MonadThrow m, HasCallStack, Exception e) =>
    e -> m a
    throwM SigParseError
    SigParseError
        array Int
    ii = do
            let c :: Int
    c = ByteString -> Int -> Int
    peekWord8AsInt ByteString
    bytes Int
    ii
            let next :: Type -> f (Int, Type)
    next Type
    t = (Int, Type) -> f (Int, Type)
    forall a. a -> f a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (Int
    ii Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    1, Type -> Type
    TypeArray Type
    t)
            Int -> (Type -> m (Int, Type)) -> m (Int, Type) -> m (Int, Type)
    forall a. Int -> (Type -> a) -> a -> a
    parseAtom Int
    c Type -> m (Int, Type)
    forall {f :: * -> *}. Applicative f => Type -> f (Int, Type)
    next (m (Int, Type) -> m (Int, Type)) -> m (Int, Type) -> m (Int, Type)
    forall a b. (a -> b) -> a -> b
    $ case Int
    c of
                Int
    0x76 -> Type -> m (Int, Type)
    forall {f :: * -> *}. Applicative f => Type -> f (Int, Type)
    next Type
    TypeVariant
                Int
    0x7B -> Int -> m (Int, Type)
    dict (Int
    ii Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    1) -- '{'
                Int
    0x28 -> do -- '('
                    (ii', t) <- Int -> m (Int, Type)
    structure (Int
    ii Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    1)
                    pure (ii', TypeArray t)
                Int
    0x61 -> do -- 'a'
                    (ii', t) <- Int -> m (Int, Type)
    array (Int
    ii Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    1)
                    pure (ii', TypeArray t)
                Int
    _ -> SigParseError -> m (Int, Type)
    forall e a. (HasCallStack, Exception e) => e -> m a
    forall (m :: * -> *) e a.
    (MonadThrow m, HasCallStack, Exception e) =>
    e -> m a
    throwM SigParseError
    SigParseError

        dict :: Int -> m (Int, Type)
    dict Int
    ii | Int
    ii Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    1 Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    >= Int
    len = SigParseError -> m (Int, Type)
    forall e a. (HasCallStack, Exception e) => e -> m a
    forall (m :: * -> *) e a.
    (MonadThrow m, HasCallStack, Exception e) =>
    e -> m a
    throwM SigParseError
    SigParseError
        dict Int
    ii = do
            let c1 :: Int
    c1 = ByteString -> Int -> Int
    peekWord8AsInt ByteString
    bytes Int
    ii
            let c2 :: Int
    c2 = ByteString -> Int -> Int
    peekWord8AsInt ByteString
    bytes (Int
    ii Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    1)

            let next :: b -> f (Int, b)
    next b
    t = (Int, b) -> f (Int, b)
    forall a. a -> f a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (Int
    ii Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    2, b
    t)
            (ii', t2) <- Int -> (Type -> m (Int, Type)) -> m (Int, Type) -> m (Int, Type)
    forall a. Int -> (Type -> a) -> a -> a
    parseAtom Int
    c2 Type -> m (Int, Type)
    forall {f :: * -> *} {b}. Applicative f => b -> f (Int, b)
    next (m (Int, Type) -> m (Int, Type)) -> m (Int, Type) -> m (Int, Type)
    forall a b. (a -> b) -> a -> b
    $ case Int
    c2 of
                Int
    0x76 -> Type -> m (Int, Type)
    forall {f :: * -> *} {b}. Applicative f => b -> f (Int, b)
    next Type
    TypeVariant
                Int
    0x28 -> Int -> m (Int, Type)
    structure (Int
    ii Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    2) -- '('
                Int
    0x61 -> Int -> m (Int, Type)
    array (Int
    ii Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    2) -- 'a'
                Int
    _ -> SigParseError -> m (Int, Type)
    forall e a. (HasCallStack, Exception e) => e -> m a
    forall (m :: * -> *) e a.
    (MonadThrow m, HasCallStack, Exception e) =>
    e -> m a
    throwM SigParseError
    SigParseError

            if ii' >= len
                then throwM SigParseError
                else do
                    let c3 = ByteString -> Int -> Int
    peekWord8AsInt ByteString
    bytes Int
    ii'
                    if c3 == 0x7D
                        then do
                            t1 <- parseAtom c1 pure (throwM SigParseError)
                            pure (ii' + 1, TypeDictionary t1 t2)
                        else throwM SigParseError

    extractFromVariant :: IsValue a => Variant -> Maybe a
    extractFromVariant :: forall a. IsValue a => Variant -> Maybe a
    extractFromVariant (Variant (ValueVariant Variant
    v)) = Variant -> Maybe a
    forall a. IsValue a => Variant -> Maybe a
    extractFromVariant Variant
    v
    extractFromVariant Variant
    v = Variant -> Maybe a
    forall a. IsVariant a => Variant -> Maybe a
    fromVariant Variant
    v

    typeOf :: forall a. IsValue a => a -> Type
    typeOf :: forall a. IsValue a => a -> Type
    typeOf a
    _ = Proxy a -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a)

    class IsVariant a where
        toVariant :: a -> Variant
        fromVariant :: Variant -> Maybe a

    -- | Value types can be used as items in containers, such as lists or
    -- dictionaries.
    --
    -- Users may not provide new instances of 'IsValue' because this could allow
    -- containers to be created with items of heterogenous types.
    class IsVariant a => IsValue a where
        typeOf_ :: Proxy a -> Type
        toValue :: a -> Value
        fromValue :: Value -> Maybe a

    -- | Atomic types can be used as keys to dictionaries.
    --
    -- Users may not provide new instances of 'IsAtom' because this could allow
    -- dictionaries to be created with invalid keys.
    class IsValue a => IsAtom a where
        toAtom :: a -> Atom
        fromAtom :: Atom -> Maybe a

    -- | Variants may contain any other built-in D-Bus value. Besides
    -- representing native @VARIANT@ values, they allow type-safe storage and
    -- inspection of D-Bus collections.
    newtype Variant = Variant Value
        deriving (Variant -> Variant -> Bool
    (Variant -> Variant -> Bool)
    -> (Variant -> Variant -> Bool) -> Eq Variant
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Variant -> Variant -> Bool
    == :: Variant -> Variant -> Bool
    $c/= :: Variant -> Variant -> Bool
    /= :: Variant -> Variant -> Bool
    Eq)

    data Value
        = ValueAtom Atom
        | ValueVariant Variant
        | ValueBytes BS.ByteString
        | ValueVector Type (Vector Value)
        | ValueMap Type Type (Map Atom Value)
        | ValueStructure [Value]
        deriving (Int -> Value -> ShowS
    [Value] -> ShowS
    Value -> String
    (Int -> Value -> ShowS)
    -> (Value -> String) -> ([Value] -> ShowS) -> Show Value
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> Value -> ShowS
    showsPrec :: Int -> Value -> ShowS
    $cshow :: Value -> String
    show :: Value -> String
    $cshowList :: [Value] -> ShowS
    showList :: [Value] -> ShowS
    Show)

    data Atom
        = AtomBool Bool
        | AtomWord8 Word8
        | AtomWord16 Word16
        | AtomWord32 Word32
        | AtomWord64 Word64
        | AtomInt16 Int16
        | AtomInt32 Int32
        | AtomInt64 Int64
        | AtomDouble Double
        | AtomUnixFd Fd
        | AtomText Text
        | AtomSignature Signature
        | AtomObjectPath ObjectPath
        deriving (Int -> Atom -> ShowS
    [Atom] -> ShowS
    Atom -> String
    (Int -> Atom -> ShowS)
    -> (Atom -> String) -> ([Atom] -> ShowS) -> Show Atom
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> Atom -> ShowS
    showsPrec :: Int -> Atom -> ShowS
    $cshow :: Atom -> String
    show :: Atom -> String
    $cshowList :: [Atom] -> ShowS
    showList :: [Atom] -> ShowS
    Show, Atom -> Atom -> Bool
    (Atom -> Atom -> Bool) -> (Atom -> Atom -> Bool) -> Eq Atom
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Atom -> Atom -> Bool
    == :: Atom -> Atom -> Bool
    $c/= :: Atom -> Atom -> Bool
    /= :: Atom -> Atom -> Bool
    Eq, Eq Atom
    Eq Atom =>
    (Atom -> Atom -> Ordering)
    -> (Atom -> Atom -> Bool)
    -> (Atom -> Atom -> Bool)
    -> (Atom -> Atom -> Bool)
    -> (Atom -> Atom -> Bool)
    -> (Atom -> Atom -> Atom)
    -> (Atom -> Atom -> Atom)
    -> Ord Atom
    Atom -> Atom -> Bool
    Atom -> Atom -> Ordering
    Atom -> Atom -> Atom
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: Atom -> Atom -> Ordering
    compare :: Atom -> Atom -> Ordering
    $c< :: Atom -> Atom -> Bool
    < :: Atom -> Atom -> Bool
    $c<= :: Atom -> Atom -> Bool
    <= :: Atom -> Atom -> Bool
    $c> :: Atom -> Atom -> Bool
    > :: Atom -> Atom -> Bool
    $c>= :: Atom -> Atom -> Bool
    >= :: Atom -> Atom -> Bool
    $cmax :: Atom -> Atom -> Atom
    max :: Atom -> Atom -> Atom
    $cmin :: Atom -> Atom -> Atom
    min :: Atom -> Atom -> Atom
    Ord)

    instance Eq Value where
        == :: Value -> Value -> Bool
    (==) (ValueBytes ByteString
    x) Value
    y = case Value
    y of
            ValueBytes ByteString
    y' -> ByteString
    x ByteString -> ByteString -> Bool
    forall a. Eq a => a -> a -> Bool
    == ByteString
    y'
            ValueVector Type
    TypeWord8 Vector Value
    y' -> ByteString
    x ByteString -> ByteString -> Bool
    forall a. Eq a => a -> a -> Bool
    == Vector Value -> ByteString
    vectorToBytes Vector Value
    y'
            Value
    _ -> Bool
    False

        (==) (ValueVector Type
    TypeWord8 Vector Value
    x) Value
    y = case Value
    y of
            ValueBytes ByteString
    y' -> Vector Value -> ByteString
    vectorToBytes Vector Value
    x ByteString -> ByteString -> Bool
    forall a. Eq a => a -> a -> Bool
    == ByteString
    y'
            ValueVector Type
    TypeWord8 Vector Value
    y' -> Vector Value
    x Vector Value -> Vector Value -> Bool
    forall a. Eq a => a -> a -> Bool
    == Vector Value
    y'
            Value
    _ -> Bool
    False

        (==) (ValueAtom Atom
    x) (ValueAtom Atom
    y) = Atom
    x Atom -> Atom -> Bool
    forall a. Eq a => a -> a -> Bool
    == Atom
    y
        (==) (ValueVariant Variant
    x) (ValueVariant Variant
    y) = Variant
    x Variant -> Variant -> Bool
    forall a. Eq a => a -> a -> Bool
    == Variant
    y
        (==) (ValueVector Type
    tx Vector Value
    x) (ValueVector Type
    ty Vector Value
    y) = Type
    tx Type -> Type -> Bool
    forall a. Eq a => a -> a -> Bool
    == Type
    ty Bool -> Bool -> Bool
    && Vector Value
    x Vector Value -> Vector Value -> Bool
    forall a. Eq a => a -> a -> Bool
    == Vector Value
    y
        (==) (ValueMap Type
    ktx Type
    vtx Map Atom Value
    x) (ValueMap Type
    kty Type
    vty Map Atom Value
    y) = Type
    ktx Type -> Type -> Bool
    forall a. Eq a => a -> a -> Bool
    == Type
    kty Bool -> Bool -> Bool
    && Type
    vtx Type -> Type -> Bool
    forall a. Eq a => a -> a -> Bool
    == Type
    vty Bool -> Bool -> Bool
    && Map Atom Value
    x Map Atom Value -> Map Atom Value -> Bool
    forall a. Eq a => a -> a -> Bool
    == Map Atom Value
    y
        (==) (ValueStructure [Value]
    x) (ValueStructure [Value]
    y) = [Value]
    x [Value] -> [Value] -> Bool
    forall a. Eq a => a -> a -> Bool
    == [Value]
    y
        (==) Value
    _ Value
    _ = Bool
    False

    showAtom :: Bool -> Atom -> String
    showAtom :: Bool -> Atom -> String
    showAtom Bool
    _ (AtomBool Bool
    x) = Bool -> String
    forall a. Show a => a -> String
    show Bool
    x
    showAtom Bool
    _ (AtomWord8 Word8
    x) = Word8 -> String
    forall a. Show a => a -> String
    show Word8
    x
    showAtom Bool
    _ (AtomWord16 Word16
    x) = Word16 -> String
    forall a. Show a => a -> String
    show Word16
    x
    showAtom Bool
    _ (AtomWord32 Word32
    x) = Word32 -> String
    forall a. Show a => a -> String
    show Word32
    x
    showAtom Bool
    _ (AtomWord64 Word64
    x) = Word64 -> String
    forall a. Show a => a -> String
    show Word64
    x
    showAtom Bool
    _ (AtomInt16 Int16
    x) = Int16 -> String
    forall a. Show a => a -> String
    show Int16
    x
    showAtom Bool
    _ (AtomInt32 Int32
    x) = Int32 -> String
    forall a. Show a => a -> String
    show Int32
    x
    showAtom Bool
    _ (AtomInt64 Int64
    x) = Int64 -> String
    forall a. Show a => a -> String
    show Int64
    x
    showAtom Bool
    _ (AtomDouble Double
    x) = Double -> String
    forall a. Show a => a -> String
    show Double
    x
    showAtom Bool
    p (AtomUnixFd Fd
    x) = Bool -> ShowS -> ShowS
    showParen Bool
    p (String -> ShowS
    showString String
    "UnixFd " ShowS -> ShowS -> ShowS
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Fd -> ShowS
    forall a. Show a => a -> ShowS
    shows Fd
    x) String
    ""
    showAtom Bool
    _ (AtomText Text
    x) = Text -> String
    forall a. Show a => a -> String
    show Text
    x
    showAtom Bool
    p (AtomSignature Signature
    x) = Int -> Signature -> ShowS
    forall a. Show a => Int -> a -> ShowS
    showsPrec (if Bool
    p then Int
    11 else Int
    0) Signature
    x String
    ""
    showAtom Bool
    p (AtomObjectPath ObjectPath
    x) = Int -> ObjectPath -> ShowS
    forall a. Show a => Int -> a -> ShowS
    showsPrec (if Bool
    p then Int
    11 else Int
    0) ObjectPath
    x String
    ""

    showValue :: Bool -> Value -> String
    showValue :: Bool -> Value -> String
    showValue Bool
    p (ValueAtom Atom
    x) = Bool -> Atom -> String
    showAtom Bool
    p Atom
    x
    showValue Bool
    p (ValueVariant Variant
    x) = Int -> Variant -> ShowS
    forall a. Show a => Int -> a -> ShowS
    showsPrec (if Bool
    p then Int
    11 else Int
    0) Variant
    x String
    ""
    showValue Bool
    _ (ValueBytes ByteString
    xs) = Char
    'b' Char -> ShowS
    forall a. a -> [a] -> [a]
    : ByteString -> String
    forall a. Show a => a -> String
    show ByteString
    xs
    showValue Bool
    _ (ValueVector Type
    TypeWord8 Vector Value
    xs) = Char
    'b' Char -> ShowS
    forall a. a -> [a] -> [a]
    : ByteString -> String
    forall a. Show a => a -> String
    show (Vector Value -> ByteString
    vectorToBytes Vector Value
    xs)
    showValue Bool
    _ (ValueVector Type
    _ Vector Value
    xs) = String -> (Value -> String) -> String -> [Value] -> String
    forall a. String -> (a -> String) -> String -> [a] -> String
    showThings String
    "[" (Bool -> Value -> String
    showValue Bool
    False) String
    "]" (Vector Value -> [Value]
    forall a. Vector a -> [a]
    Data.Vector.toList Vector Value
    xs)
    showValue Bool
    _ (ValueMap Type
    _ Type
    _ Map Atom Value
    xs) = String
    -> ((Atom, Value) -> String) -> String -> [(Atom, Value)] -> String
    forall a. String -> (a -> String) -> String -> [a] -> String
    showThings String
    "{" (Atom, Value) -> String
    showPair String
    "}" (Map Atom Value -> [(Atom, Value)]
    forall k a. Map k a -> [(k, a)]
    Data.Map.toList Map Atom Value
    xs) where
        showPair :: (Atom, Value) -> String
    showPair (Atom
    k, Value
    v) = Bool -> Atom -> String
    showAtom Bool
    False Atom
    k String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ String
    ": " String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ Bool -> Value -> String
    showValue Bool
    False Value
    v
    showValue Bool
    _ (ValueStructure [Value]
    xs) = String -> (Value -> String) -> String -> [Value] -> String
    forall a. String -> (a -> String) -> String -> [a] -> String
    showThings String
    "(" (Bool -> Value -> String
    showValue Bool
    False) String
    ")" [Value]
    xs

    showThings :: String -> (a -> String) -> String -> [a] -> String
    showThings :: forall a. String -> (a -> String) -> String -> [a] -> String
    showThings String
    a a -> String
    s String
    z [a]
    xs = String
    a String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ String -> [String] -> String
    forall a. [a] -> [[a]] -> [a]
    intercalate String
    ", " ((a -> String) -> [a] -> [String]
    forall a b. (a -> b) -> [a] -> [b]
    map a -> String
    s [a]
    xs) String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ String
    z

    vectorToBytes :: Vector Value -> BS.ByteString
    vectorToBytes :: Vector Value -> ByteString
    vectorToBytes = [Word8] -> ByteString
    BS.pack
                  ([Word8] -> ByteString)
    -> (Vector Value -> [Word8]) -> Vector Value -> ByteString
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Vector Word8 -> [Word8]
    forall a. Vector a -> [a]
    Data.Vector.toList
                  (Vector Word8 -> [Word8])
    -> (Vector Value -> Vector Word8) -> Vector Value -> [Word8]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Value -> Word8) -> Vector Value -> Vector Word8
    forall a b. (a -> b) -> Vector a -> Vector b
    Data.Vector.map (\(ValueAtom (AtomWord8 Word8
    x)) -> Word8
    x)

    instance Show Variant where
        showsPrec :: Int -> Variant -> ShowS
    showsPrec Int
    d (Variant Value
    x) = Bool -> ShowS -> ShowS
    showParen (Int
    d Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    > Int
    10) (ShowS -> ShowS) -> ShowS -> ShowS
    forall a b. (a -> b) -> a -> b
    $
            String -> ShowS
    showString String
    "Variant " ShowS -> ShowS -> ShowS
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    .  String -> ShowS
    showString (Bool -> Value -> String
    showValue Bool
    True Value
    x)

    -- | Every variant is strongly-typed; that is, the type of its contained
    -- value is known at all times. This function retrieves that type, so that
    -- the correct cast can be used to retrieve the value.
    variantType :: Variant -> Type
    variantType :: Variant -> Type
    variantType (Variant Value
    val) = Value -> Type
    valueType Value
    val

    valueType :: Value -> Type
    valueType :: Value -> Type
    valueType (ValueAtom Atom
    x) = Atom -> Type
    atomType Atom
    x
    valueType (ValueVariant Variant
    _) = Type
    TypeVariant
    valueType (ValueVector Type
    t Vector Value
    _) = Type -> Type
    TypeArray Type
    t
    valueType (ValueBytes ByteString
    _) = Type -> Type
    TypeArray Type
    TypeWord8
    valueType (ValueMap Type
    kt Type
    vt Map Atom Value
    _) = Type -> Type -> Type
    TypeDictionary Type
    kt Type
    vt
    valueType (ValueStructure [Value]
    vs) = [Type] -> Type
    TypeStructure ((Value -> Type) -> [Value] -> [Type]
    forall a b. (a -> b) -> [a] -> [b]
    map Value -> Type
    valueType [Value]
    vs)

    atomType :: Atom -> Type
    atomType :: Atom -> Type
    atomType (AtomBool Bool
    _) = Type
    TypeBoolean
    atomType (AtomWord8 Word8
    _) = Type
    TypeWord8
    atomType (AtomWord16 Word16
    _) = Type
    TypeWord16
    atomType (AtomWord32 Word32
    _) = Type
    TypeWord32
    atomType (AtomWord64 Word64
    _) = Type
    TypeWord64
    atomType (AtomInt16 Int16
    _) = Type
    TypeInt16
    atomType (AtomInt32 Int32
    _) = Type
    TypeInt32
    atomType (AtomInt64 Int64
    _) = Type
    TypeInt64
    atomType (AtomDouble Double
    _) = Type
    TypeDouble
    atomType (AtomUnixFd Fd
    _) = Type
    TypeUnixFd
    atomType (AtomText Text
    _) = Type
    TypeString
    atomType (AtomSignature Signature
    _) = Type
    TypeSignature
    atomType (AtomObjectPath ObjectPath
    _) = Type
    TypeObjectPath

    #define IS_ATOM(HsType, AtomCons, TypeCons) \
        instance IsAtom HsType where \
        { toAtom = AtomCons \
        ; fromAtom (AtomCons x) = Just x \
        ; fromAtom _ = Nothing \
        }; \
        instance IsValue HsType where \
        { typeOf_ _ = TypeCons \
        ; toValue = ValueAtom . toAtom \
        ; fromValue (ValueAtom x) = fromAtom x \
        ; fromValue _ = Nothing \
        }; \
        instance IsVariant HsType where \
        { toVariant = Variant . toValue \
        ; fromVariant (Variant val) = fromValue val \
        }

    IS_ATOM(Bool,       AtomBool,       TypeBoolean)
    IS_ATOM(Word8,      AtomWord8,      TypeWord8)
    IS_ATOM(Word16,     AtomWord16,     TypeWord16)
    IS_ATOM(Word32,     AtomWord32,     TypeWord32)
    IS_ATOM(Word64,     AtomWord64,     TypeWord64)
    IS_ATOM(Int16,      AtomInt16,      TypeInt16)
    IS_ATOM(Int32,      AtomInt32,      TypeInt32)
    IS_ATOM(Int64,      AtomInt64,      TypeInt64)
    IS_ATOM(Double,     AtomDouble,     TypeDouble)
    IS_ATOM(Fd,         AtomUnixFd,     TypeUnixFd)
    IS_ATOM(Text,       AtomText,       TypeString)
    IS_ATOM(Signature,  AtomSignature,  TypeSignature)
    IS_ATOM(ObjectPath, AtomObjectPath, TypeObjectPath)

    instance IsValue Variant where
        typeOf_ :: Proxy Variant -> Type
    typeOf_ Proxy Variant
    _ = Type
    TypeVariant
        toValue :: Variant -> Value
    toValue = Variant -> Value
    ValueVariant
        fromValue :: Value -> Maybe Variant
    fromValue (ValueVariant Variant
    x) = Variant -> Maybe Variant
    forall a. a -> Maybe a
    Just Variant
    x
        fromValue Value
    _ = Maybe Variant
    forall a. Maybe a
    Nothing

    instance IsVariant Variant where
        toVariant :: Variant -> Variant
    toVariant = Value -> Variant
    Variant (Value -> Variant) -> (Variant -> Value) -> Variant -> Variant
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Variant -> Value
    forall a. IsValue a => a -> Value
    toValue
        fromVariant :: Variant -> Maybe Variant
    fromVariant (Variant Value
    val) = Value -> Maybe Variant
    forall a. IsValue a => Value -> Maybe a
    fromValue Value
    val

    instance IsAtom Data.Text.Lazy.Text where
        toAtom :: Text -> Atom
    toAtom = Text -> Atom
    forall a. IsAtom a => a -> Atom
    toAtom (Text -> Atom) -> (Text -> Text) -> Text -> Atom
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Text -> Text
    Data.Text.Lazy.toStrict
        fromAtom :: Atom -> Maybe Text
    fromAtom = (Text -> Text) -> Maybe Text -> Maybe Text
    forall a b. (a -> b) -> Maybe a -> Maybe b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Text -> Text
    Data.Text.Lazy.fromStrict (Maybe Text -> Maybe Text)
    -> (Atom -> Maybe Text) -> Atom -> Maybe Text
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Atom -> Maybe Text
    forall a. IsAtom a => Atom -> Maybe a
    fromAtom

    instance IsValue Data.Text.Lazy.Text where
        typeOf_ :: Proxy Text -> Type
    typeOf_ Proxy Text
    _ = Type
    TypeString
        toValue :: Text -> Value
    toValue = Atom -> Value
    ValueAtom (Atom -> Value) -> (Text -> Atom) -> Text -> Value
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Text -> Atom
    forall a. IsAtom a => a -> Atom
    toAtom
        fromValue :: Value -> Maybe Text
    fromValue (ValueAtom Atom
    x) = Atom -> Maybe Text
    forall a. IsAtom a => Atom -> Maybe a
    fromAtom Atom
    x
        fromValue Value
    _ = Maybe Text
    forall a. Maybe a
    Nothing

    instance IsVariant Data.Text.Lazy.Text where
        toVariant :: Text -> Variant
    toVariant = Value -> Variant
    Variant (Value -> Variant) -> (Text -> Value) -> Text -> Variant
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Text -> Value
    forall a. IsValue a => a -> Value
    toValue
        fromVariant :: Variant -> Maybe Text
    fromVariant (Variant Value
    val) = Value -> Maybe Text
    forall a. IsValue a => Value -> Maybe a
    fromValue Value
    val

    instance IsAtom String where
        toAtom :: String -> Atom
    toAtom = Text -> Atom
    forall a. IsAtom a => a -> Atom
    toAtom (Text -> Atom) -> (String -> Text) -> String -> Atom
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> Text
    Data.Text.pack
        fromAtom :: Atom -> Maybe String
    fromAtom = (Text -> String) -> Maybe Text -> Maybe String
    forall a b. (a -> b) -> Maybe a -> Maybe b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Text -> String
    Data.Text.unpack (Maybe Text -> Maybe String)
    -> (Atom -> Maybe Text) -> Atom -> Maybe String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Atom -> Maybe Text
    forall a. IsAtom a => Atom -> Maybe a
    fromAtom

    instance IsValue String where
        typeOf_ :: Proxy String -> Type
    typeOf_ Proxy String
    _ = Type
    TypeString
        toValue :: String -> Value
    toValue = Atom -> Value
    ValueAtom (Atom -> Value) -> (String -> Atom) -> String -> Value
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> Atom
    forall a. IsAtom a => a -> Atom
    toAtom
        fromValue :: Value -> Maybe String
    fromValue (ValueAtom Atom
    x) = Atom -> Maybe String
    forall a. IsAtom a => Atom -> Maybe a
    fromAtom Atom
    x
        fromValue Value
    _ = Maybe String
    forall a. Maybe a
    Nothing

    instance IsVariant String where
        toVariant :: String -> Variant
    toVariant = Value -> Variant
    Variant (Value -> Variant) -> (String -> Value) -> String -> Variant
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> Value
    forall a. IsValue a => a -> Value
    toValue
        fromVariant :: Variant -> Maybe String
    fromVariant (Variant Value
    val) = Value -> Maybe String
    forall a. IsValue a => Value -> Maybe a
    fromValue Value
    val

    instance IsValue a => IsValue (Vector a) where
        typeOf_ :: Proxy (Vector a) -> Type
    typeOf_ Proxy (Vector a)
    _ = Type -> Type
    TypeArray (Proxy a -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a))
        toValue :: Vector a -> Value
    toValue Vector a
    v = Type -> Vector Value -> Value
    ValueVector
            (Proxy a -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a))
            ((a -> Value) -> Vector a -> Vector Value
    forall a b. (a -> b) -> Vector a -> Vector b
    Data.Vector.map a -> Value
    forall a. IsValue a => a -> Value
    toValue Vector a
    v)
        fromValue :: Value -> Maybe (Vector a)
    fromValue (ValueVector Type
    _ Vector Value
    v) = (Value -> Maybe a) -> Vector Value -> Maybe (Vector a)
    forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> Vector a -> m (Vector b)
    Data.Vector.mapM Value -> Maybe a
    forall a. IsValue a => Value -> Maybe a
    fromValue Vector Value
    v
        fromValue Value
    _ = Maybe (Vector a)
    forall a. Maybe a
    Nothing

    instance IsValue a => IsVariant (Vector a) where
        toVariant :: Vector a -> Variant
    toVariant = Value -> Variant
    Variant (Value -> Variant) -> (Vector a -> Value) -> Vector a -> Variant
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Vector a -> Value
    forall a. IsValue a => a -> Value
    toValue
        fromVariant :: Variant -> Maybe (Vector a)
    fromVariant (Variant Value
    val) = Value -> Maybe (Vector a)
    forall a. IsValue a => Value -> Maybe a
    fromValue Value
    val

    instance IsValue a => IsValue [a] where
        typeOf_ :: Proxy [a] -> Type
    typeOf_ Proxy [a]
    _ = Type -> Type
    TypeArray (Proxy a -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a))
        toValue :: [a] -> Value
    toValue = Vector a -> Value
    forall a. IsValue a => a -> Value
    toValue (Vector a -> Value) -> ([a] -> Vector a) -> [a] -> Value
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [a] -> Vector a
    forall a. [a] -> Vector a
    Data.Vector.fromList
        fromValue :: Value -> Maybe [a]
    fromValue = (Vector a -> [a]) -> Maybe (Vector a) -> Maybe [a]
    forall a b. (a -> b) -> Maybe a -> Maybe b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Vector a -> [a]
    forall a. Vector a -> [a]
    Data.Vector.toList (Maybe (Vector a) -> Maybe [a])
    -> (Value -> Maybe (Vector a)) -> Value -> Maybe [a]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Value -> Maybe (Vector a)
    forall a. IsValue a => Value -> Maybe a
    fromValue

    instance IsValue a => IsVariant [a] where
        toVariant :: [a] -> Variant
    toVariant = Vector a -> Variant
    forall a. IsVariant a => a -> Variant
    toVariant (Vector a -> Variant) -> ([a] -> Vector a) -> [a] -> Variant
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [a] -> Vector a
    forall a. [a] -> Vector a
    Data.Vector.fromList
        fromVariant :: Variant -> Maybe [a]
    fromVariant = (Vector a -> [a]) -> Maybe (Vector a) -> Maybe [a]
    forall a b. (a -> b) -> Maybe a -> Maybe b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Vector a -> [a]
    forall a. Vector a -> [a]
    Data.Vector.toList (Maybe (Vector a) -> Maybe [a])
    -> (Variant -> Maybe (Vector a)) -> Variant -> Maybe [a]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Variant -> Maybe (Vector a)
    forall a. IsVariant a => Variant -> Maybe a
    fromVariant

    instance IsValue BS.ByteString where
        typeOf_ :: Proxy ByteString -> Type
    typeOf_ Proxy ByteString
    _ = Type -> Type
    TypeArray Type
    TypeWord8
        toValue :: ByteString -> Value
    toValue = ByteString -> Value
    ValueBytes
        fromValue :: Value -> Maybe ByteString
    fromValue (ValueBytes ByteString
    bs) = ByteString -> Maybe ByteString
    forall a. a -> Maybe a
    Just ByteString
    bs
        fromValue (ValueVector Type
    TypeWord8 Vector Value
    v) = ByteString -> Maybe ByteString
    forall a. a -> Maybe a
    Just (Vector Value -> ByteString
    vectorToBytes Vector Value
    v)
        fromValue Value
    _ = Maybe ByteString
    forall a. Maybe a
    Nothing

    instance IsVariant BS.ByteString where
        toVariant :: ByteString -> Variant
    toVariant = Value -> Variant
    Variant (Value -> Variant)
    -> (ByteString -> Value) -> ByteString -> Variant
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ByteString -> Value
    forall a. IsValue a => a -> Value
    toValue
        fromVariant :: Variant -> Maybe ByteString
    fromVariant (Variant Value
    val) = Value -> Maybe ByteString
    forall a. IsValue a => Value -> Maybe a
    fromValue Value
    val

    instance IsValue BL.ByteString where
        typeOf_ :: Proxy ByteString -> Type
    typeOf_ Proxy ByteString
    _ = Type -> Type
    TypeArray Type
    TypeWord8
        toValue :: ByteString -> Value
    toValue = ByteString -> Value
    forall a. IsValue a => a -> Value
    toValue
                (ByteString -> Value)
    -> (ByteString -> ByteString) -> ByteString -> Value
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [ByteString] -> ByteString
    BS.concat
                ([ByteString] -> ByteString)
    -> (ByteString -> [ByteString]) -> ByteString -> ByteString
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ByteString -> [ByteString]
    BL.toChunks
        fromValue :: Value -> Maybe ByteString
    fromValue = (ByteString -> ByteString) -> Maybe ByteString -> Maybe ByteString
    forall a b. (a -> b) -> Maybe a -> Maybe b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap (\ByteString
    bs -> [ByteString] -> ByteString
    BL.fromChunks [ByteString
    bs])
                  (Maybe ByteString -> Maybe ByteString)
    -> (Value -> Maybe ByteString) -> Value -> Maybe ByteString
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Value -> Maybe ByteString
    forall a. IsValue a => Value -> Maybe a
    fromValue

    instance IsVariant BL.ByteString where
        toVariant :: ByteString -> Variant
    toVariant = Value -> Variant
    Variant (Value -> Variant)
    -> (ByteString -> Value) -> ByteString -> Variant
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ByteString -> Value
    forall a. IsValue a => a -> Value
    toValue
        fromVariant :: Variant -> Maybe ByteString
    fromVariant (Variant Value
    val) = Value -> Maybe ByteString
    forall a. IsValue a => Value -> Maybe a
    fromValue Value
    val

    instance (Ord k, IsAtom k, IsValue v) => IsValue (Map k v) where
        typeOf_ :: Proxy (Map k v) -> Type
    typeOf_ Proxy (Map k v)
    _ = Type -> Type -> Type
    TypeDictionary
            (Proxy k -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy k
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy k))
            (Proxy v -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy v
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy v))

        toValue :: Map k v -> Value
    toValue Map k v
    m = Type -> Type -> Map Atom Value -> Value
    ValueMap Type
    kt Type
    vt ((k -> v -> (Atom, Value)) -> Map k v -> Map Atom Value
    forall k' k v v'.
    Ord k' =>
    (k -> v -> (k', v')) -> Map k v -> Map k' v'
    bimap k -> v -> (Atom, Value)
    forall {a} {a}. (IsAtom a, IsValue a) => a -> a -> (Atom, Value)
    box Map k v
    m) where
            kt :: Type
    kt = Proxy k -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy k
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy k)
            vt :: Type
    vt = Proxy v -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy v
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy v)
            box :: a -> a -> (Atom, Value)
    box a
    k a
    v = (a -> Atom
    forall a. IsAtom a => a -> Atom
    toAtom a
    k, a -> Value
    forall a. IsValue a => a -> Value
    toValue a
    v)

        fromValue :: Value -> Maybe (Map k v)
    fromValue (ValueMap Type
    _ Type
    _ Map Atom Value
    m) = (Atom -> Value -> Maybe (k, v))
    -> Map Atom Value -> Maybe (Map k v)
    forall (m :: * -> *) k' k v v'.
    (Monad m, Ord k') =>
    (k -> v -> m (k', v')) -> Map k v -> m (Map k' v')
    bimapM Atom -> Value -> Maybe (k, v)
    forall {a} {b}.
    (IsAtom a, IsValue b) =>
    Atom -> Value -> Maybe (a, b)
    unbox Map Atom Value
    m where
            unbox :: Atom -> Value -> Maybe (a, b)
    unbox Atom
    k Value
    v = do
                k' <- Atom -> Maybe a
    forall a. IsAtom a => Atom -> Maybe a
    fromAtom Atom
    k
                v' <- fromValue v
                return (k', v')
        fromValue Value
    _ = Maybe (Map k v)
    forall a. Maybe a
    Nothing

    bimap :: Ord k' => (k -> v -> (k', v')) -> Map k v -> Map k' v'
    bimap :: forall k' k v v'.
    Ord k' =>
    (k -> v -> (k', v')) -> Map k v -> Map k' v'
    bimap k -> v -> (k', v')
    f = [(k', v')] -> Map k' v'
    forall k a. Ord k => [(k, a)] -> Map k a
    Data.Map.fromList ([(k', v')] -> Map k' v')
    -> (Map k v -> [(k', v')]) -> Map k v -> Map k' v'
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ((k, v) -> (k', v')) -> [(k, v)] -> [(k', v')]
    forall a b. (a -> b) -> [a] -> [b]
    map (\(k
    k, v
    v) -> k -> v -> (k', v')
    f k
    k v
    v) ([(k, v)] -> [(k', v')])
    -> (Map k v -> [(k, v)]) -> Map k v -> [(k', v')]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Map k v -> [(k, v)]
    forall k a. Map k a -> [(k, a)]
    Data.Map.toList

    bimapM :: (Monad m, Ord k') => (k -> v -> m (k', v')) -> Map k v -> m (Map k' v')
    bimapM :: forall (m :: * -> *) k' k v v'.
    (Monad m, Ord k') =>
    (k -> v -> m (k', v')) -> Map k v -> m (Map k' v')
    bimapM k -> v -> m (k', v')
    f = ([(k', v')] -> Map k' v') -> m [(k', v')] -> m (Map k' v')
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM [(k', v')] -> Map k' v'
    forall k a. Ord k => [(k, a)] -> Map k a
    Data.Map.fromList (m [(k', v')] -> m (Map k' v'))
    -> (Map k v -> m [(k', v')]) -> Map k v -> m (Map k' v')
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ((k, v) -> m (k', v')) -> [(k, v)] -> m [(k', v')]
    forall (t :: * -> *) (m :: * -> *) a b.
    (Traversable t, Monad m) =>
    (a -> m b) -> t a -> m (t b)
    forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
    mapM (\(k
    k, v
    v) -> k -> v -> m (k', v')
    f k
    k v
    v) ([(k, v)] -> m [(k', v')])
    -> (Map k v -> [(k, v)]) -> Map k v -> m [(k', v')]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Map k v -> [(k, v)]
    forall k a. Map k a -> [(k, a)]
    Data.Map.toList

    instance (Ord k, IsAtom k, IsValue v) => IsVariant (Map k v) where
        toVariant :: Map k v -> Variant
    toVariant = Value -> Variant
    Variant (Value -> Variant) -> (Map k v -> Value) -> Map k v -> Variant
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Map k v -> Value
    forall a. IsValue a => a -> Value
    toValue
        fromVariant :: Variant -> Maybe (Map k v)
    fromVariant (Variant Value
    val) = Value -> Maybe (Map k v)
    forall a. IsValue a => Value -> Maybe a
    fromValue Value
    val

    instance IsValue () where
      typeOf_ :: Proxy () -> Type
    typeOf_ Proxy ()
    _ = [Type] -> Type
    TypeStructure []
      toValue :: () -> Value
    toValue ()
    _ = [Value] -> Value
    ValueStructure []
      fromValue :: Value -> Maybe ()
    fromValue (ValueStructure []) = () -> Maybe ()
    forall a. a -> Maybe a
    forall (m :: * -> *) a. Monad m => a -> m a
    return ()
      fromValue Value
    _ = Maybe ()
    forall a. Maybe a
    Nothing

    instance IsVariant () where
      toVariant :: () -> Variant
    toVariant () = Value -> Variant
    Variant ([Value] -> Value
    ValueStructure [])
      fromVariant :: Variant -> Maybe ()
    fromVariant (Variant (ValueStructure [])) = () -> Maybe ()
    forall a. a -> Maybe a
    Just ()
      fromVariant Variant
    _ = Maybe ()
    forall a. Maybe a
    Nothing

    instance (IsValue a1, IsValue a2) => IsValue (a1, a2) where
        typeOf_ :: Proxy (a1, a2) -> Type
    typeOf_ Proxy (a1, a2)
    _ = [Type] -> Type
    TypeStructure
            [ Proxy a1 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a1
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a1)
            , Proxy a2 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a2
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a2)
            ]
        toValue :: (a1, a2) -> Value
    toValue (a1
    a1, a2
    a2) = [Value] -> Value
    ValueStructure [a1 -> Value
    forall a. IsValue a => a -> Value
    toValue a1
    a1, a2 -> Value
    forall a. IsValue a => a -> Value
    toValue a2
    a2]
        fromValue :: Value -> Maybe (a1, a2)
    fromValue (ValueStructure [Value
    a1, Value
    a2]) = do
            a1' <- Value -> Maybe a1
    forall a. IsValue a => Value -> Maybe a
    fromValue Value
    a1
            a2' <- fromValue a2
            return (a1', a2')
        fromValue Value
    _ = Maybe (a1, a2)
    forall a. Maybe a
    Nothing

    instance (IsVariant a1, IsVariant a2) => IsVariant (a1, a2) where
        toVariant :: (a1, a2) -> Variant
    toVariant (a1
    a1, a2
    a2) = Value -> Variant
    Variant ([Value] -> Value
    ValueStructure [a1 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a1
    a1, a2 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a2
    a2])
        fromVariant :: Variant -> Maybe (a1, a2)
    fromVariant (Variant (ValueStructure [Value
    a1, Value
    a2])) = do
            a1' <- (Variant -> Maybe a1
    forall a. IsVariant a => Variant -> Maybe a
    fromVariant (Variant -> Maybe a1) -> (Value -> Variant) -> Value -> Maybe a1
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Value -> Variant
    Variant) Value
    a1
            a2' <- (fromVariant . Variant) a2
            return (a1', a2')
        fromVariant Variant
    _ = Maybe (a1, a2)
    forall a. Maybe a
    Nothing

    varToVal :: IsVariant a => a -> Value
    varToVal :: forall a. IsVariant a => a -> Value
    varToVal a
    a = case a -> Variant
    forall a. IsVariant a => a -> Variant
    toVariant a
    a of
        Variant Value
    val -> Value
    val

    -- | Object paths are special strings, used to identify a particular object
    -- exported from a D-Bus application.
    --
    -- Object paths must begin with a slash, and consist of alphanumeric
    -- characters separated by slashes.
    --
    -- See
    -- <http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-marshaling-object-path>
    -- for details.
    newtype ObjectPath = ObjectPath String
        deriving (ObjectPath -> ObjectPath -> Bool
    (ObjectPath -> ObjectPath -> Bool)
    -> (ObjectPath -> ObjectPath -> Bool) -> Eq ObjectPath
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: ObjectPath -> ObjectPath -> Bool
    == :: ObjectPath -> ObjectPath -> Bool
    $c/= :: ObjectPath -> ObjectPath -> Bool
    /= :: ObjectPath -> ObjectPath -> Bool
    Eq, Eq ObjectPath
    Eq ObjectPath =>
    (ObjectPath -> ObjectPath -> Ordering)
    -> (ObjectPath -> ObjectPath -> Bool)
    -> (ObjectPath -> ObjectPath -> Bool)
    -> (ObjectPath -> ObjectPath -> Bool)
    -> (ObjectPath -> ObjectPath -> Bool)
    -> (ObjectPath -> ObjectPath -> ObjectPath)
    -> (ObjectPath -> ObjectPath -> ObjectPath)
    -> Ord ObjectPath
    ObjectPath -> ObjectPath -> Bool
    ObjectPath -> ObjectPath -> Ordering
    ObjectPath -> ObjectPath -> ObjectPath
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: ObjectPath -> ObjectPath -> Ordering
    compare :: ObjectPath -> ObjectPath -> Ordering
    $c< :: ObjectPath -> ObjectPath -> Bool
    < :: ObjectPath -> ObjectPath -> Bool
    $c<= :: ObjectPath -> ObjectPath -> Bool
    <= :: ObjectPath -> ObjectPath -> Bool
    $c> :: ObjectPath -> ObjectPath -> Bool
    > :: ObjectPath -> ObjectPath -> Bool
    $c>= :: ObjectPath -> ObjectPath -> Bool
    >= :: ObjectPath -> ObjectPath -> Bool
    $cmax :: ObjectPath -> ObjectPath -> ObjectPath
    max :: ObjectPath -> ObjectPath -> ObjectPath
    $cmin :: ObjectPath -> ObjectPath -> ObjectPath
    min :: ObjectPath -> ObjectPath -> ObjectPath
    Ord, Int -> ObjectPath -> ShowS
    [ObjectPath] -> ShowS
    ObjectPath -> String
    (Int -> ObjectPath -> ShowS)
    -> (ObjectPath -> String)
    -> ([ObjectPath] -> ShowS)
    -> Show ObjectPath
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> ObjectPath -> ShowS
    showsPrec :: Int -> ObjectPath -> ShowS
    $cshow :: ObjectPath -> String
    show :: ObjectPath -> String
    $cshowList :: [ObjectPath] -> ShowS
    showList :: [ObjectPath] -> ShowS
    Show, ObjectPath -> ()
    (ObjectPath -> ()) -> NFData ObjectPath
    forall a. (a -> ()) -> NFData a
    $crnf :: ObjectPath -> ()
    rnf :: ObjectPath -> ()
    NFData)

    pathElements :: ObjectPath -> [String]
    pathElements :: ObjectPath -> [String]
    pathElements = (String -> Bool) -> [String] -> [String]
    forall a. (a -> Bool) -> [a] -> [a]
    filter (Bool -> Bool
    not (Bool -> Bool) -> (String -> Bool) -> String -> Bool
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> Bool
    forall a. [a] -> Bool
    forall (t :: * -> *) a. Foldable t => t a -> Bool
    null) ([String] -> [String])
    -> (ObjectPath -> [String]) -> ObjectPath -> [String]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> String -> [String]
    forall a. Eq a => [a] -> [a] -> [[a]]
    splitOn String
    "/" (String -> [String])
    -> (ObjectPath -> String) -> ObjectPath -> [String]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ObjectPath -> String
    forall a b. Coercible a b => a -> b
    coerce

    fromElements :: [String] -> ObjectPath
    fromElements :: [String] -> ObjectPath
    fromElements [String]
    elems = String -> ObjectPath
    objectPath_ (String -> ObjectPath) -> String -> ObjectPath
    forall a b. (a -> b) -> a -> b
    $ Char
    '/'Char -> ShowS
    forall a. a -> [a] -> [a]
    :String -> [String] -> String
    forall a. [a] -> [[a]] -> [a]
    intercalate String
    "/" [String]
    elems

    formatObjectPath :: ObjectPath -> String
    formatObjectPath :: ObjectPath -> String
    formatObjectPath (ObjectPath String
    s) = String
    s

    parseObjectPath :: MonadThrow m => String -> m ObjectPath
    parseObjectPath :: forall (m :: * -> *). MonadThrow m => String -> m ObjectPath
    parseObjectPath String
    s = do
        Parser () -> String -> m ()
    forall (m :: * -> *) a. MonadThrow m => Parser a -> String -> m a
    maybeParseString Parser ()
    parserObjectPath String
    s
        ObjectPath -> m ObjectPath
    forall a. a -> m a
    forall (m :: * -> *) a. Monad m => a -> m a
    return (String -> ObjectPath
    ObjectPath String
    s)

    objectPath_ :: String -> ObjectPath
    objectPath_ :: String -> ObjectPath
    objectPath_ = String -> (String -> Maybe ObjectPath) -> String -> ObjectPath
    forall a. String -> (String -> Maybe a) -> String -> a
    forceParse String
    "object path" String -> Maybe ObjectPath
    forall (m :: * -> *). MonadThrow m => String -> m ObjectPath
    parseObjectPath

    instance Data.String.IsString ObjectPath where
        fromString :: String -> ObjectPath
    fromString = String -> ObjectPath
    objectPath_

    parserObjectPath :: Parsec.Parser ()
    parserObjectPath :: Parser ()
    parserObjectPath = Parser ()
    forall {st}. GenParser Char st ()
    root Parser () -> Parser () -> Parser ()
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> Parser ()
    object where
        root :: GenParser Char st ()
    root = GenParser Char st () -> GenParser Char st ()
    forall tok st a. GenParser tok st a -> GenParser tok st a
    Parsec.try (GenParser Char st () -> GenParser Char st ())
    -> GenParser Char st () -> GenParser Char st ()
    forall a b. (a -> b) -> a -> b
    $ do
            GenParser Char st ()
    forall {st}. GenParser Char st ()
    slash
            GenParser Char st ()
    forall s (m :: * -> *) t u.
    (Stream s m t, Show t) =>
    ParsecT s u m ()
    Parsec.eof

        object :: Parser ()
    object = do
            Parser ()
    forall {st}. GenParser Char st ()
    slash
            Parser () -> Parser () -> Parser ()
    forall a b. Parser a -> Parser b -> Parser ()
    skipSepBy1 Parser ()
    forall {st}. GenParser Char st ()
    element Parser ()
    forall {st}. GenParser Char st ()
    slash
            Parser ()
    forall s (m :: * -> *) t u.
    (Stream s m t, Show t) =>
    ParsecT s u m ()
    Parsec.eof

        element :: ParsecT String u Identity ()
    element = ParsecT String u Identity Char -> ParsecT String u Identity ()
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m ()
    Parsec.skipMany1 (String -> ParsecT String u Identity Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    String -> ParsecT s u m Char
    oneOf String
    chars)

        slash :: ParsecT String u Identity ()
    slash = Char -> ParsecT String u Identity Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    Parsec.char Char
    '/' ParsecT String u Identity Char
    -> ParsecT String u Identity () -> ParsecT String u Identity ()
    forall a b.
    ParsecT String u Identity a
    -> ParsecT String u Identity b -> ParsecT String u Identity b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> () -> ParsecT String u Identity ()
    forall a. a -> ParsecT String u Identity a
    forall (m :: * -> *) a. Monad m => a -> m a
    return ()
        chars :: String
    chars = [String] -> String
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat [ [Char
    'a'..Char
    'z']
                       , [Char
    'A'..Char
    'Z']
                       , [Char
    '0'..Char
    '9']
                       , String
    "_"]

    -- | Interfaces are used to group a set of methods and signals within an
    -- exported object. Interface names consist of alphanumeric characters
    -- separated by periods.
    --
    -- See
    -- <http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-interface>
    -- for details.
    newtype InterfaceName = InterfaceName String
        deriving (InterfaceName -> InterfaceName -> Bool
    (InterfaceName -> InterfaceName -> Bool)
    -> (InterfaceName -> InterfaceName -> Bool) -> Eq InterfaceName
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: InterfaceName -> InterfaceName -> Bool
    == :: InterfaceName -> InterfaceName -> Bool
    $c/= :: InterfaceName -> InterfaceName -> Bool
    /= :: InterfaceName -> InterfaceName -> Bool
    Eq, Eq InterfaceName
    Eq InterfaceName =>
    (InterfaceName -> InterfaceName -> Ordering)
    -> (InterfaceName -> InterfaceName -> Bool)
    -> (InterfaceName -> InterfaceName -> Bool)
    -> (InterfaceName -> InterfaceName -> Bool)
    -> (InterfaceName -> InterfaceName -> Bool)
    -> (InterfaceName -> InterfaceName -> InterfaceName)
    -> (InterfaceName -> InterfaceName -> InterfaceName)
    -> Ord InterfaceName
    InterfaceName -> InterfaceName -> Bool
    InterfaceName -> InterfaceName -> Ordering
    InterfaceName -> InterfaceName -> InterfaceName
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: InterfaceName -> InterfaceName -> Ordering
    compare :: InterfaceName -> InterfaceName -> Ordering
    $c< :: InterfaceName -> InterfaceName -> Bool
    < :: InterfaceName -> InterfaceName -> Bool
    $c<= :: InterfaceName -> InterfaceName -> Bool
    <= :: InterfaceName -> InterfaceName -> Bool
    $c> :: InterfaceName -> InterfaceName -> Bool
    > :: InterfaceName -> InterfaceName -> Bool
    $c>= :: InterfaceName -> InterfaceName -> Bool
    >= :: InterfaceName -> InterfaceName -> Bool
    $cmax :: InterfaceName -> InterfaceName -> InterfaceName
    max :: InterfaceName -> InterfaceName -> InterfaceName
    $cmin :: InterfaceName -> InterfaceName -> InterfaceName
    min :: InterfaceName -> InterfaceName -> InterfaceName
    Ord, Int -> InterfaceName -> ShowS
    [InterfaceName] -> ShowS
    InterfaceName -> String
    (Int -> InterfaceName -> ShowS)
    -> (InterfaceName -> String)
    -> ([InterfaceName] -> ShowS)
    -> Show InterfaceName
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> InterfaceName -> ShowS
    showsPrec :: Int -> InterfaceName -> ShowS
    $cshow :: InterfaceName -> String
    show :: InterfaceName -> String
    $cshowList :: [InterfaceName] -> ShowS
    showList :: [InterfaceName] -> ShowS
    Show, InterfaceName -> ()
    (InterfaceName -> ()) -> NFData InterfaceName
    forall a. (a -> ()) -> NFData a
    $crnf :: InterfaceName -> ()
    rnf :: InterfaceName -> ()
    NFData)

    formatInterfaceName :: InterfaceName -> String
    formatInterfaceName :: InterfaceName -> String
    formatInterfaceName (InterfaceName String
    s) = String
    s

    parseInterfaceName :: MonadThrow m => String -> m InterfaceName
    parseInterfaceName :: forall (m :: * -> *). MonadThrow m => String -> m InterfaceName
    parseInterfaceName String
    s = do
        Bool -> m () -> m ()
    forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
    when (String -> Int
    forall a. [a] -> Int
    forall (t :: * -> *) a. Foldable t => t a -> Int
    length String
    s Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    > Int
    255) (m () -> m ()) -> m () -> m ()
    forall a b. (a -> b) -> a -> b
    $ IOError -> m ()
    forall e a. (HasCallStack, Exception e) => e -> m a
    forall (m :: * -> *) e a.
    (MonadThrow m, HasCallStack, Exception e) =>
    e -> m a
    throwM (IOError -> m ()) -> IOError -> m ()
    forall a b. (a -> b) -> a -> b
    $ String -> IOError
    userError String
    "name too long"
        Parser () -> String -> m ()
    forall (m :: * -> *) a. MonadThrow m => Parser a -> String -> m a
    maybeParseString Parser ()
    parserInterfaceName String
    s
        InterfaceName -> m InterfaceName
    forall a. a -> m a
    forall (m :: * -> *) a. Monad m => a -> m a
    return (String -> InterfaceName
    InterfaceName String
    s)

    interfaceName_ :: String -> InterfaceName
    interfaceName_ :: String -> InterfaceName
    interfaceName_ = String
    -> (String -> Maybe InterfaceName) -> String -> InterfaceName
    forall a. String -> (String -> Maybe a) -> String -> a
    forceParse String
    "interface name" String -> Maybe InterfaceName
    forall (m :: * -> *). MonadThrow m => String -> m InterfaceName
    parseInterfaceName

    instance Data.String.IsString InterfaceName where
        fromString :: String -> InterfaceName
    fromString = String -> InterfaceName
    interfaceName_

    instance IsVariant InterfaceName where
        toVariant :: InterfaceName -> Variant
    toVariant = String -> Variant
    forall a. IsVariant a => a -> Variant
    toVariant (String -> Variant)
    -> (InterfaceName -> String) -> InterfaceName -> Variant
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . InterfaceName -> String
    formatInterfaceName
        fromVariant :: Variant -> Maybe InterfaceName
    fromVariant = Variant -> Maybe String
    forall a. IsVariant a => Variant -> Maybe a
    fromVariant (Variant -> Maybe String)
    -> (String -> Maybe InterfaceName)
    -> Variant
    -> Maybe InterfaceName
    forall (m :: * -> *) a b c.
    Monad m =>
    (a -> m b) -> (b -> m c) -> a -> m c
    >=> String -> Maybe InterfaceName
    forall (m :: * -> *). MonadThrow m => String -> m InterfaceName
    parseInterfaceName

    parserInterfaceName :: Parsec.Parser ()
    parserInterfaceName :: Parser ()
    parserInterfaceName = Parser ()
    name Parser () -> Parser () -> Parser ()
    forall a b.
    ParsecT String () Identity a
    -> ParsecT String () Identity b -> ParsecT String () Identity b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> Parser ()
    forall s (m :: * -> *) t u.
    (Stream s m t, Show t) =>
    ParsecT s u m ()
    Parsec.eof where
        alpha :: String
    alpha = [Char
    'a'..Char
    'z'] String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ [Char
    'A'..Char
    'Z'] String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ String
    "_"
        alphanum :: String
    alphanum = String
    alpha String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ [Char
    '0'..Char
    '9']
        element :: ParsecT String u Identity ()
    element = do
            _ <- String -> ParsecT String u Identity Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    String -> ParsecT s u m Char
    oneOf String
    alpha
            Parsec.skipMany (oneOf alphanum)
        name :: Parser ()
    name = do
            Parser ()
    forall {st}. GenParser Char st ()
    element
            _ <- Char -> ParsecT String () Identity Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    Parsec.char Char
    '.'
            skipSepBy1 element (Parsec.char '.')

    -- | Member names are used to identify a single method or signal within an
    -- interface. Method names consist of alphanumeric characters.
    --
    -- See
    -- <http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-member>
    -- for details.
    newtype MemberName = MemberName String
        deriving (MemberName -> MemberName -> Bool
    (MemberName -> MemberName -> Bool)
    -> (MemberName -> MemberName -> Bool) -> Eq MemberName
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: MemberName -> MemberName -> Bool
    == :: MemberName -> MemberName -> Bool
    $c/= :: MemberName -> MemberName -> Bool
    /= :: MemberName -> MemberName -> Bool
    Eq, Eq MemberName
    Eq MemberName =>
    (MemberName -> MemberName -> Ordering)
    -> (MemberName -> MemberName -> Bool)
    -> (MemberName -> MemberName -> Bool)
    -> (MemberName -> MemberName -> Bool)
    -> (MemberName -> MemberName -> Bool)
    -> (MemberName -> MemberName -> MemberName)
    -> (MemberName -> MemberName -> MemberName)
    -> Ord MemberName
    MemberName -> MemberName -> Bool
    MemberName -> MemberName -> Ordering
    MemberName -> MemberName -> MemberName
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: MemberName -> MemberName -> Ordering
    compare :: MemberName -> MemberName -> Ordering
    $c< :: MemberName -> MemberName -> Bool
    < :: MemberName -> MemberName -> Bool
    $c<= :: MemberName -> MemberName -> Bool
    <= :: MemberName -> MemberName -> Bool
    $c> :: MemberName -> MemberName -> Bool
    > :: MemberName -> MemberName -> Bool
    $c>= :: MemberName -> MemberName -> Bool
    >= :: MemberName -> MemberName -> Bool
    $cmax :: MemberName -> MemberName -> MemberName
    max :: MemberName -> MemberName -> MemberName
    $cmin :: MemberName -> MemberName -> MemberName
    min :: MemberName -> MemberName -> MemberName
    Ord, Int -> MemberName -> ShowS
    [MemberName] -> ShowS
    MemberName -> String
    (Int -> MemberName -> ShowS)
    -> (MemberName -> String)
    -> ([MemberName] -> ShowS)
    -> Show MemberName
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> MemberName -> ShowS
    showsPrec :: Int -> MemberName -> ShowS
    $cshow :: MemberName -> String
    show :: MemberName -> String
    $cshowList :: [MemberName] -> ShowS
    showList :: [MemberName] -> ShowS
    Show, MemberName -> ()
    (MemberName -> ()) -> NFData MemberName
    forall a. (a -> ()) -> NFData a
    $crnf :: MemberName -> ()
    rnf :: MemberName -> ()
    NFData)

    formatMemberName :: MemberName -> String
    formatMemberName :: MemberName -> String
    formatMemberName (MemberName String
    s) = String
    s

    parseMemberName :: MonadThrow m => String -> m MemberName
    parseMemberName :: forall (m :: * -> *). MonadThrow m => String -> m MemberName
    parseMemberName String
    s = do
        Bool -> m () -> m ()
    forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
    when (String -> Int
    forall a. [a] -> Int
    forall (t :: * -> *) a. Foldable t => t a -> Int
    length String
    s Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    > Int
    255) (m () -> m ()) -> m () -> m ()
    forall a b. (a -> b) -> a -> b
    $ IOError -> m ()
    forall e a. (HasCallStack, Exception e) => e -> m a
    forall (m :: * -> *) e a.
    (MonadThrow m, HasCallStack, Exception e) =>
    e -> m a
    throwM (IOError -> m ()) -> IOError -> m ()
    forall a b. (a -> b) -> a -> b
    $ String -> IOError
    userError String
    "name too long"
        Parser () -> String -> m ()
    forall (m :: * -> *) a. MonadThrow m => Parser a -> String -> m a
    maybeParseString Parser ()
    parserMemberName String
    s
        MemberName -> m MemberName
    forall a. a -> m a
    forall (m :: * -> *) a. Monad m => a -> m a
    return (String -> MemberName
    MemberName String
    s)

    memberName_ :: String -> MemberName
    memberName_ :: String -> MemberName
    memberName_ = String -> (String -> Maybe MemberName) -> String -> MemberName
    forall a. String -> (String -> Maybe a) -> String -> a
    forceParse String
    "member name" String -> Maybe MemberName
    forall (m :: * -> *). MonadThrow m => String -> m MemberName
    parseMemberName

    instance Data.String.IsString MemberName where
        fromString :: String -> MemberName
    fromString = String -> MemberName
    memberName_

    instance IsVariant MemberName where
        toVariant :: MemberName -> Variant
    toVariant = String -> Variant
    forall a. IsVariant a => a -> Variant
    toVariant (String -> Variant)
    -> (MemberName -> String) -> MemberName -> Variant
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . MemberName -> String
    formatMemberName
        fromVariant :: Variant -> Maybe MemberName
    fromVariant = Variant -> Maybe String
    forall a. IsVariant a => Variant -> Maybe a
    fromVariant (Variant -> Maybe String)
    -> (String -> Maybe MemberName) -> Variant -> Maybe MemberName
    forall (m :: * -> *) a b c.
    Monad m =>
    (a -> m b) -> (b -> m c) -> a -> m c
    >=> String -> Maybe MemberName
    forall (m :: * -> *). MonadThrow m => String -> m MemberName
    parseMemberName

    parserMemberName :: Parsec.Parser ()
    parserMemberName :: Parser ()
    parserMemberName = Parser ()
    forall {st}. GenParser Char st ()
    name Parser () -> Parser () -> Parser ()
    forall a b.
    ParsecT String () Identity a
    -> ParsecT String () Identity b -> ParsecT String () Identity b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> Parser ()
    forall s (m :: * -> *) t u.
    (Stream s m t, Show t) =>
    ParsecT s u m ()
    Parsec.eof where
        alpha :: String
    alpha = [Char
    'a'..Char
    'z'] String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ [Char
    'A'..Char
    'Z'] String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ String
    "_"
        alphanum :: String
    alphanum = String
    alpha String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ [Char
    '0'..Char
    '9']
        name :: ParsecT String u Identity ()
    name = do
            _ <- String -> ParsecT String u Identity Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    String -> ParsecT s u m Char
    oneOf String
    alpha
            Parsec.skipMany (oneOf alphanum)

    -- | Error names are used to identify which type of error was returned from
    -- a method call. Error names consist of alphanumeric characters
    -- separated by periods.
    --
    -- See
    -- <http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-error>
    -- for details.
    newtype ErrorName = ErrorName String
        deriving (ErrorName -> ErrorName -> Bool
    (ErrorName -> ErrorName -> Bool)
    -> (ErrorName -> ErrorName -> Bool) -> Eq ErrorName
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: ErrorName -> ErrorName -> Bool
    == :: ErrorName -> ErrorName -> Bool
    $c/= :: ErrorName -> ErrorName -> Bool
    /= :: ErrorName -> ErrorName -> Bool
    Eq, Eq ErrorName
    Eq ErrorName =>
    (ErrorName -> ErrorName -> Ordering)
    -> (ErrorName -> ErrorName -> Bool)
    -> (ErrorName -> ErrorName -> Bool)
    -> (ErrorName -> ErrorName -> Bool)
    -> (ErrorName -> ErrorName -> Bool)
    -> (ErrorName -> ErrorName -> ErrorName)
    -> (ErrorName -> ErrorName -> ErrorName)
    -> Ord ErrorName
    ErrorName -> ErrorName -> Bool
    ErrorName -> ErrorName -> Ordering
    ErrorName -> ErrorName -> ErrorName
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: ErrorName -> ErrorName -> Ordering
    compare :: ErrorName -> ErrorName -> Ordering
    $c< :: ErrorName -> ErrorName -> Bool
    < :: ErrorName -> ErrorName -> Bool
    $c<= :: ErrorName -> ErrorName -> Bool
    <= :: ErrorName -> ErrorName -> Bool
    $c> :: ErrorName -> ErrorName -> Bool
    > :: ErrorName -> ErrorName -> Bool
    $c>= :: ErrorName -> ErrorName -> Bool
    >= :: ErrorName -> ErrorName -> Bool
    $cmax :: ErrorName -> ErrorName -> ErrorName
    max :: ErrorName -> ErrorName -> ErrorName
    $cmin :: ErrorName -> ErrorName -> ErrorName
    min :: ErrorName -> ErrorName -> ErrorName
    Ord, Int -> ErrorName -> ShowS
    [ErrorName] -> ShowS
    ErrorName -> String
    (Int -> ErrorName -> ShowS)
    -> (ErrorName -> String)
    -> ([ErrorName] -> ShowS)
    -> Show ErrorName
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> ErrorName -> ShowS
    showsPrec :: Int -> ErrorName -> ShowS
    $cshow :: ErrorName -> String
    show :: ErrorName -> String
    $cshowList :: [ErrorName] -> ShowS
    showList :: [ErrorName] -> ShowS
    Show, ErrorName -> ()
    (ErrorName -> ()) -> NFData ErrorName
    forall a. (a -> ()) -> NFData a
    $crnf :: ErrorName -> ()
    rnf :: ErrorName -> ()
    NFData)

    formatErrorName :: ErrorName -> String
    formatErrorName :: ErrorName -> String
    formatErrorName (ErrorName String
    s) = String
    s

    parseErrorName :: MonadThrow m => String -> m ErrorName
    parseErrorName :: forall (m :: * -> *). MonadThrow m => String -> m ErrorName
    parseErrorName String
    s = do
        Bool -> m () -> m ()
    forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
    when (String -> Int
    forall a. [a] -> Int
    forall (t :: * -> *) a. Foldable t => t a -> Int
    length String
    s Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    > Int
    255) (m () -> m ()) -> m () -> m ()
    forall a b. (a -> b) -> a -> b
    $ IOError -> m ()
    forall e a. (HasCallStack, Exception e) => e -> m a
    forall (m :: * -> *) e a.
    (MonadThrow m, HasCallStack, Exception e) =>
    e -> m a
    throwM (IOError -> m ()) -> IOError -> m ()
    forall a b. (a -> b) -> a -> b
    $ String -> IOError
    userError String
    "name too long"
        Parser () -> String -> m ()
    forall (m :: * -> *) a. MonadThrow m => Parser a -> String -> m a
    maybeParseString Parser ()
    parserInterfaceName String
    s
        ErrorName -> m ErrorName
    forall a. a -> m a
    forall (m :: * -> *) a. Monad m => a -> m a
    return (String -> ErrorName
    ErrorName String
    s)

    errorName_ :: String -> ErrorName
    errorName_ :: String -> ErrorName
    errorName_ = String -> (String -> Maybe ErrorName) -> String -> ErrorName
    forall a. String -> (String -> Maybe a) -> String -> a
    forceParse String
    "error name" String -> Maybe ErrorName
    forall (m :: * -> *). MonadThrow m => String -> m ErrorName
    parseErrorName

    instance Data.String.IsString ErrorName where
        fromString :: String -> ErrorName
    fromString = String -> ErrorName
    errorName_

    instance IsVariant ErrorName where
        toVariant :: ErrorName -> Variant
    toVariant = String -> Variant
    forall a. IsVariant a => a -> Variant
    toVariant (String -> Variant)
    -> (ErrorName -> String) -> ErrorName -> Variant
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ErrorName -> String
    formatErrorName
        fromVariant :: Variant -> Maybe ErrorName
    fromVariant = Variant -> Maybe String
    forall a. IsVariant a => Variant -> Maybe a
    fromVariant (Variant -> Maybe String)
    -> (String -> Maybe ErrorName) -> Variant -> Maybe ErrorName
    forall (m :: * -> *) a b c.
    Monad m =>
    (a -> m b) -> (b -> m c) -> a -> m c
    >=> String -> Maybe ErrorName
    forall (m :: * -> *). MonadThrow m => String -> m ErrorName
    parseErrorName

    -- | Bus names are used to identify particular clients on the message bus.
    -- A bus name may be either /unique/ or /well-known/, where unique names
    -- start with a colon. Bus names consist of alphanumeric characters separated
    -- by periods.
    --
    -- See
    -- <http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-bus>
    -- for details.
    newtype BusName = BusName String
        deriving (BusName -> BusName -> Bool
    (BusName -> BusName -> Bool)
    -> (BusName -> BusName -> Bool) -> Eq BusName
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: BusName -> BusName -> Bool
    == :: BusName -> BusName -> Bool
    $c/= :: BusName -> BusName -> Bool
    /= :: BusName -> BusName -> Bool
    Eq, Eq BusName
    Eq BusName =>
    (BusName -> BusName -> Ordering)
    -> (BusName -> BusName -> Bool)
    -> (BusName -> BusName -> Bool)
    -> (BusName -> BusName -> Bool)
    -> (BusName -> BusName -> Bool)
    -> (BusName -> BusName -> BusName)
    -> (BusName -> BusName -> BusName)
    -> Ord BusName
    BusName -> BusName -> Bool
    BusName -> BusName -> Ordering
    BusName -> BusName -> BusName
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: BusName -> BusName -> Ordering
    compare :: BusName -> BusName -> Ordering
    $c< :: BusName -> BusName -> Bool
    < :: BusName -> BusName -> Bool
    $c<= :: BusName -> BusName -> Bool
    <= :: BusName -> BusName -> Bool
    $c> :: BusName -> BusName -> Bool
    > :: BusName -> BusName -> Bool
    $c>= :: BusName -> BusName -> Bool
    >= :: BusName -> BusName -> Bool
    $cmax :: BusName -> BusName -> BusName
    max :: BusName -> BusName -> BusName
    $cmin :: BusName -> BusName -> BusName
    min :: BusName -> BusName -> BusName
    Ord, Int -> BusName -> ShowS
    [BusName] -> ShowS
    BusName -> String
    (Int -> BusName -> ShowS)
    -> (BusName -> String) -> ([BusName] -> ShowS) -> Show BusName
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> BusName -> ShowS
    showsPrec :: Int -> BusName -> ShowS
    $cshow :: BusName -> String
    show :: BusName -> String
    $cshowList :: [BusName] -> ShowS
    showList :: [BusName] -> ShowS
    Show, BusName -> ()
    (BusName -> ()) -> NFData BusName
    forall a. (a -> ()) -> NFData a
    $crnf :: BusName -> ()
    rnf :: BusName -> ()
    NFData)

    formatBusName :: BusName -> String
    formatBusName :: BusName -> String
    formatBusName (BusName String
    s) = String
    s

    parseBusName :: MonadThrow m => String -> m BusName
    parseBusName :: forall (m :: * -> *). MonadThrow m => String -> m BusName
    parseBusName String
    s = do
        Bool -> m () -> m ()
    forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
    when (String -> Int
    forall a. [a] -> Int
    forall (t :: * -> *) a. Foldable t => t a -> Int
    length String
    s Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    > Int
    255) (m () -> m ()) -> m () -> m ()
    forall a b. (a -> b) -> a -> b
    $ IOError -> m ()
    forall e a. (HasCallStack, Exception e) => e -> m a
    forall (m :: * -> *) e a.
    (MonadThrow m, HasCallStack, Exception e) =>
    e -> m a
    throwM (IOError -> m ()) -> IOError -> m ()
    forall a b. (a -> b) -> a -> b
    $ String -> IOError
    userError String
    "name too long"
        Parser () -> String -> m ()
    forall (m :: * -> *) a. MonadThrow m => Parser a -> String -> m a
    maybeParseString Parser ()
    parserBusName String
    s
        BusName -> m BusName
    forall a. a -> m a
    forall (m :: * -> *) a. Monad m => a -> m a
    return (String -> BusName
    BusName String
    s)

    busName_ :: String -> BusName
    busName_ :: String -> BusName
    busName_ = String -> (String -> Maybe BusName) -> String -> BusName
    forall a. String -> (String -> Maybe a) -> String -> a
    forceParse String
    "bus name" String -> Maybe BusName
    forall (m :: * -> *). MonadThrow m => String -> m BusName
    parseBusName

    instance Data.String.IsString BusName where
        fromString :: String -> BusName
    fromString = String -> BusName
    busName_

    instance IsVariant BusName where
        toVariant :: BusName -> Variant
    toVariant = String -> Variant
    forall a. IsVariant a => a -> Variant
    toVariant (String -> Variant) -> (BusName -> String) -> BusName -> Variant
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . BusName -> String
    formatBusName
        fromVariant :: Variant -> Maybe BusName
    fromVariant = Variant -> Maybe String
    forall a. IsVariant a => Variant -> Maybe a
    fromVariant (Variant -> Maybe String)
    -> (String -> Maybe BusName) -> Variant -> Maybe BusName
    forall (m :: * -> *) a b c.
    Monad m =>
    (a -> m b) -> (b -> m c) -> a -> m c
    >=> String -> Maybe BusName
    forall (m :: * -> *). MonadThrow m => String -> m BusName
    parseBusName

    parserBusName :: Parsec.Parser ()
    parserBusName :: Parser ()
    parserBusName = Parser ()
    name Parser () -> Parser () -> Parser ()
    forall a b.
    ParsecT String () Identity a
    -> ParsecT String () Identity b -> ParsecT String () Identity b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> Parser ()
    forall s (m :: * -> *) t u.
    (Stream s m t, Show t) =>
    ParsecT s u m ()
    Parsec.eof where
        alpha :: String
    alpha = [Char
    'a'..Char
    'z'] String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ [Char
    'A'..Char
    'Z'] String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ String
    "_-"
        alphanum :: String
    alphanum = String
    alpha String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ [Char
    '0'..Char
    '9']

        name :: Parser ()
    name = Parser ()
    unique Parser () -> Parser () -> Parser ()
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> Parser ()
    wellKnown
        unique :: Parser ()
    unique = do
            _ <- Char -> ParsecT String () Identity Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    Parsec.char Char
    ':'
            elements alphanum

        wellKnown :: Parser ()
    wellKnown = String -> Parser ()
    elements String
    alpha

        elements :: [Char] -> Parsec.Parser ()
        elements :: String -> Parser ()
    elements String
    start = do
            String -> Parser ()
    element String
    start
            Parser () -> Parser ()
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m ()
    Parsec.skipMany1 (Parser () -> Parser ()) -> Parser () -> Parser ()
    forall a b. (a -> b) -> a -> b
    $ do
                _ <- Char -> ParsecT String () Identity Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    Parsec.char Char
    '.'
                element start

        element :: [Char] -> Parsec.Parser ()
        element :: String -> Parser ()
    element String
    start = do
            _ <- String -> ParsecT String () Identity Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    String -> ParsecT s u m Char
    oneOf String
    start
            Parsec.skipMany (oneOf alphanum)

    -- | A D-Bus Structure is a container type similar to Haskell tuples, storing
    -- values of any type that is convertable to 'IsVariant'. A Structure may
    -- contain up to 255 values.
    --
    -- Most users can use the 'IsVariant' instance for tuples to extract the
    -- values of a structure. This type is for very large structures, which may
    -- be awkward to work with as tuples.
    newtype Structure = Structure [Value]
        deriving (Structure -> Structure -> Bool
    (Structure -> Structure -> Bool)
    -> (Structure -> Structure -> Bool) -> Eq Structure
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Structure -> Structure -> Bool
    == :: Structure -> Structure -> Bool
    $c/= :: Structure -> Structure -> Bool
    /= :: Structure -> Structure -> Bool
    Eq)

    instance Show Structure where
        show :: Structure -> String
    show (Structure [Value]
    xs) = Bool -> Value -> String
    showValue Bool
    True ([Value] -> Value
    ValueStructure [Value]
    xs)

    instance IsVariant Structure where
        toVariant :: Structure -> Variant
    toVariant (Structure [Value]
    xs) = Value -> Variant
    Variant ([Value] -> Value
    ValueStructure [Value]
    xs)
        fromVariant :: Variant -> Maybe Structure
    fromVariant (Variant (ValueStructure [Value]
    xs)) = Structure -> Maybe Structure
    forall a. a -> Maybe a
    Just ([Value] -> Structure
    Structure [Value]
    xs)
        fromVariant Variant
    _ = Maybe Structure
    forall a. Maybe a
    Nothing

    structureItems :: Structure -> [Variant]
    structureItems :: Structure -> [Variant]
    structureItems (Structure [Value]
    xs) = (Value -> Variant) -> [Value] -> [Variant]
    forall a b. (a -> b) -> [a] -> [b]
    map Value -> Variant
    Variant [Value]
    xs

    -- | A D-Bus Array is a container type similar to Haskell lists, storing
    -- zero or more values of a single D-Bus type.
    --
    -- Most users can use the 'IsVariant' instance for lists or vectors to extract
    -- the values of an array. This type is for advanced use cases, where the user
    -- wants to convert array values to Haskell types that are not instances of
    -- 'IsValue'.
    data Array
        = Array Type (Vector Value)
        | ArrayBytes BS.ByteString

    instance Show Array where
        show :: Array -> String
    show (Array Type
    t Vector Value
    xs) = Bool -> Value -> String
    showValue Bool
    True (Type -> Vector Value -> Value
    ValueVector Type
    t Vector Value
    xs)
        show (ArrayBytes ByteString
    xs) = Bool -> Value -> String
    showValue Bool
    True (ByteString -> Value
    ValueBytes ByteString
    xs)

    instance Eq Array where
        Array
    x == :: Array -> Array -> Bool
    == Array
    y = Array -> Either ByteString (Type, Vector Value)
    norm Array
    x Either ByteString (Type, Vector Value)
    -> Either ByteString (Type, Vector Value) -> Bool
    forall a. Eq a => a -> a -> Bool
    == Array -> Either ByteString (Type, Vector Value)
    norm Array
    y where
            norm :: Array -> Either ByteString (Type, Vector Value)
    norm (Array Type
    TypeWord8 Vector Value
    xs) = ByteString -> Either ByteString (Type, Vector Value)
    forall a b. a -> Either a b
    Left (Vector Value -> ByteString
    vectorToBytes Vector Value
    xs)
            norm (Array Type
    t Vector Value
    xs) = (Type, Vector Value) -> Either ByteString (Type, Vector Value)
    forall a b. b -> Either a b
    Right (Type
    t, Vector Value
    xs)
            norm (ArrayBytes ByteString
    xs) = ByteString -> Either ByteString (Type, Vector Value)
    forall a b. a -> Either a b
    Left ByteString
    xs

    instance IsVariant Array where
        toVariant :: Array -> Variant
    toVariant (Array Type
    t Vector Value
    xs) = Value -> Variant
    Variant (Type -> Vector Value -> Value
    ValueVector Type
    t Vector Value
    xs)
        toVariant (ArrayBytes ByteString
    bs) = Value -> Variant
    Variant (ByteString -> Value
    ValueBytes ByteString
    bs)
        fromVariant :: Variant -> Maybe Array
    fromVariant (Variant (ValueVector Type
    t Vector Value
    xs)) = Array -> Maybe Array
    forall a. a -> Maybe a
    Just (Type -> Vector Value -> Array
    Array Type
    t Vector Value
    xs)
        fromVariant (Variant (ValueBytes ByteString
    bs)) = Array -> Maybe Array
    forall a. a -> Maybe a
    Just (ByteString -> Array
    ArrayBytes ByteString
    bs)
        fromVariant Variant
    _ = Maybe Array
    forall a. Maybe a
    Nothing

    arrayItems :: Array -> [Variant]
    arrayItems :: Array -> [Variant]
    arrayItems (Array Type
    _ Vector Value
    xs) = (Value -> Variant) -> [Value] -> [Variant]
    forall a b. (a -> b) -> [a] -> [b]
    map Value -> Variant
    Variant (Vector Value -> [Value]
    forall a. Vector a -> [a]
    Data.Vector.toList Vector Value
    xs)
    arrayItems (ArrayBytes ByteString
    bs) = (Word8 -> Variant) -> [Word8] -> [Variant]
    forall a b. (a -> b) -> [a] -> [b]
    map Word8 -> Variant
    forall a. IsVariant a => a -> Variant
    toVariant (ByteString -> [Word8]
    BS.unpack ByteString
    bs)

    -- | A D-Bus Dictionary is a container type similar to Haskell maps, storing
    -- zero or more associations between keys and values.
    --
    -- Most users can use the 'IsVariant' instance for maps to extract the values
    -- of a dictionary. This type is for advanced use cases, where the user
    -- wants to convert dictionary items to Haskell types that are not instances
    -- of 'IsValue'.
    data Dictionary = Dictionary Type Type (Map Atom Value)
        deriving (Dictionary -> Dictionary -> Bool
    (Dictionary -> Dictionary -> Bool)
    -> (Dictionary -> Dictionary -> Bool) -> Eq Dictionary
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Dictionary -> Dictionary -> Bool
    == :: Dictionary -> Dictionary -> Bool
    $c/= :: Dictionary -> Dictionary -> Bool
    /= :: Dictionary -> Dictionary -> Bool
    Eq)

    instance Show Dictionary where
        show :: Dictionary -> String
    show (Dictionary Type
    kt Type
    vt Map Atom Value
    xs) = Bool -> Value -> String
    showValue Bool
    True (Type -> Type -> Map Atom Value -> Value
    ValueMap Type
    kt Type
    vt Map Atom Value
    xs)

    instance IsVariant Dictionary where
        toVariant :: Dictionary -> Variant
    toVariant (Dictionary Type
    kt Type
    vt Map Atom Value
    xs) = Value -> Variant
    Variant (Type -> Type -> Map Atom Value -> Value
    ValueMap Type
    kt Type
    vt Map Atom Value
    xs)
        fromVariant :: Variant -> Maybe Dictionary
    fromVariant (Variant (ValueMap Type
    kt Type
    vt Map Atom Value
    xs)) = Dictionary -> Maybe Dictionary
    forall a. a -> Maybe a
    Just (Type -> Type -> Map Atom Value -> Dictionary
    Dictionary Type
    kt Type
    vt Map Atom Value
    xs)
        fromVariant Variant
    _ = Maybe Dictionary
    forall a. Maybe a
    Nothing

    dictionaryItems :: Dictionary -> [(Variant, Variant)]
    dictionaryItems :: Dictionary -> [(Variant, Variant)]
    dictionaryItems (Dictionary Type
    _ Type
    _ Map Atom Value
    xs) = do
        (k, v) <- Map Atom Value -> [(Atom, Value)]
    forall k a. Map k a -> [(k, a)]
    Data.Map.toList Map Atom Value
    xs
        return (Variant (ValueAtom k), Variant v)

    instance (IsValue a1, IsValue a2, IsValue a3) => IsValue (a1, a2, a3) where
        typeOf_ :: Proxy (a1, a2, a3) -> Type
    typeOf_ Proxy (a1, a2, a3)
    _ = [Type] -> Type
    TypeStructure
            [ Proxy a1 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a1
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a1)
            , Proxy a2 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a2
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a2)
            , Proxy a3 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a3
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a3)
            ]
        toValue :: (a1, a2, a3) -> Value
    toValue (a1
    a1, a2
    a2, a3
    a3) = [Value] -> Value
    ValueStructure [a1 -> Value
    forall a. IsValue a => a -> Value
    toValue a1
    a1, a2 -> Value
    forall a. IsValue a => a -> Value
    toValue a2
    a2, a3 -> Value
    forall a. IsValue a => a -> Value
    toValue a3
    a3]
        fromValue :: Value -> Maybe (a1, a2, a3)
    fromValue (ValueStructure [Value
    a1, Value
    a2, Value
    a3]) = do
            a1' <- Value -> Maybe a1
    forall a. IsValue a => Value -> Maybe a
    fromValue Value
    a1
            a2' <- fromValue a2
            a3' <- fromValue a3
            return (a1', a2', a3')
        fromValue Value
    _ = Maybe (a1, a2, a3)
    forall a. Maybe a
    Nothing

    instance (IsValue a1, IsValue a2, IsValue a3, IsValue a4) => IsValue (a1, a2, a3, a4) where
        typeOf_ :: Proxy (a1, a2, a3, a4) -> Type
    typeOf_ Proxy (a1, a2, a3, a4)
    _ = [Type] -> Type
    TypeStructure
            [ Proxy a1 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a1
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a1)
            , Proxy a2 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a2
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a2)
            , Proxy a3 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a3
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a3)
            , Proxy a4 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a4
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a4)
            ]
        toValue :: (a1, a2, a3, a4) -> Value
    toValue (a1
    a1, a2
    a2, a3
    a3, a4
    a4) = [Value] -> Value
    ValueStructure [a1 -> Value
    forall a. IsValue a => a -> Value
    toValue a1
    a1, a2 -> Value
    forall a. IsValue a => a -> Value
    toValue a2
    a2, a3 -> Value
    forall a. IsValue a => a -> Value
    toValue a3
    a3, a4 -> Value
    forall a. IsValue a => a -> Value
    toValue a4
    a4]
        fromValue :: Value -> Maybe (a1, a2, a3, a4)
    fromValue (ValueStructure [Value
    a1, Value
    a2, Value
    a3, Value
    a4]) = do
            a1' <- Value -> Maybe a1
    forall a. IsValue a => Value -> Maybe a
    fromValue Value
    a1
            a2' <- fromValue a2
            a3' <- fromValue a3
            a4' <- fromValue a4
            return (a1', a2', a3', a4')
        fromValue Value
    _ = Maybe (a1, a2, a3, a4)
    forall a. Maybe a
    Nothing

    instance (IsValue a1, IsValue a2, IsValue a3, IsValue a4, IsValue a5) => IsValue (a1, a2, a3, a4, a5) where
        typeOf_ :: Proxy (a1, a2, a3, a4, a5) -> Type
    typeOf_ Proxy (a1, a2, a3, a4, a5)
    _ = [Type] -> Type
    TypeStructure
            [ Proxy a1 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a1
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a1)
            , Proxy a2 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a2
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a2)
            , Proxy a3 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a3
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a3)
            , Proxy a4 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a4
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a4)
            , Proxy a5 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a5
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a5)
            ]
        toValue :: (a1, a2, a3, a4, a5) -> Value
    toValue (a1
    a1, a2
    a2, a3
    a3, a4
    a4, a5
    a5) = [Value] -> Value
    ValueStructure [a1 -> Value
    forall a. IsValue a => a -> Value
    toValue a1
    a1, a2 -> Value
    forall a. IsValue a => a -> Value
    toValue a2
    a2, a3 -> Value
    forall a. IsValue a => a -> Value
    toValue a3
    a3, a4 -> Value
    forall a. IsValue a => a -> Value
    toValue a4
    a4, a5 -> Value
    forall a. IsValue a => a -> Value
    toValue a5
    a5]
        fromValue :: Value -> Maybe (a1, a2, a3, a4, a5)
    fromValue (ValueStructure [Value
    a1, Value
    a2, Value
    a3, Value
    a4, Value
    a5]) = do
            a1' <- Value -> Maybe a1
    forall a. IsValue a => Value -> Maybe a
    fromValue Value
    a1
            a2' <- fromValue a2
            a3' <- fromValue a3
            a4' <- fromValue a4
            a5' <- fromValue a5
            return (a1', a2', a3', a4', a5')
        fromValue Value
    _ = Maybe (a1, a2, a3, a4, a5)
    forall a. Maybe a
    Nothing

    instance (IsValue a1, IsValue a2, IsValue a3, IsValue a4, IsValue a5, IsValue a6) => IsValue (a1, a2, a3, a4, a5, a6) where
        typeOf_ :: Proxy (a1, a2, a3, a4, a5, a6) -> Type
    typeOf_ Proxy (a1, a2, a3, a4, a5, a6)
    _ = [Type] -> Type
    TypeStructure
            [ Proxy a1 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a1
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a1)
            , Proxy a2 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a2
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a2)
            , Proxy a3 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a3
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a3)
            , Proxy a4 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a4
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a4)
            , Proxy a5 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a5
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a5)
            , Proxy a6 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a6
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a6)
            ]
        toValue :: (a1, a2, a3, a4, a5, a6) -> Value
    toValue (a1
    a1, a2
    a2, a3
    a3, a4
    a4, a5
    a5, a6
    a6) = [Value] -> Value
    ValueStructure [a1 -> Value
    forall a. IsValue a => a -> Value
    toValue a1
    a1, a2 -> Value
    forall a. IsValue a => a -> Value
    toValue a2
    a2, a3 -> Value
    forall a. IsValue a => a -> Value
    toValue a3
    a3, a4 -> Value
    forall a. IsValue a => a -> Value
    toValue a4
    a4, a5 -> Value
    forall a. IsValue a => a -> Value
    toValue a5
    a5, a6 -> Value
    forall a. IsValue a => a -> Value
    toValue a6
    a6]
        fromValue :: Value -> Maybe (a1, a2, a3, a4, a5, a6)
    fromValue (ValueStructure [Value
    a1, Value
    a2, Value
    a3, Value
    a4, Value
    a5, Value
    a6]) = do
            a1' <- Value -> Maybe a1
    forall a. IsValue a => Value -> Maybe a
    fromValue Value
    a1
            a2' <- fromValue a2
            a3' <- fromValue a3
            a4' <- fromValue a4
            a5' <- fromValue a5
            a6' <- fromValue a6
            return (a1', a2', a3', a4', a5', a6')
        fromValue Value
    _ = Maybe (a1, a2, a3, a4, a5, a6)
    forall a. Maybe a
    Nothing

    instance (IsValue a1, IsValue a2, IsValue a3, IsValue a4, IsValue a5, IsValue a6, IsValue a7) => IsValue (a1, a2, a3, a4, a5, a6, a7) where
        typeOf_ :: Proxy (a1, a2, a3, a4, a5, a6, a7) -> Type
    typeOf_ Proxy (a1, a2, a3, a4, a5, a6, a7)
    _ = [Type] -> Type
    TypeStructure
            [ Proxy a1 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a1
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a1)
            , Proxy a2 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a2
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a2)
            , Proxy a3 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a3
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a3)
            , Proxy a4 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a4
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a4)
            , Proxy a5 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a5
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a5)
            , Proxy a6 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a6
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a6)
            , Proxy a7 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a7
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a7)
            ]
        toValue :: (a1, a2, a3, a4, a5, a6, a7) -> Value
    toValue (a1
    a1, a2
    a2, a3
    a3, a4
    a4, a5
    a5, a6
    a6, a7
    a7) = [Value] -> Value
    ValueStructure [a1 -> Value
    forall a. IsValue a => a -> Value
    toValue a1
    a1, a2 -> Value
    forall a. IsValue a => a -> Value
    toValue a2
    a2, a3 -> Value
    forall a. IsValue a => a -> Value
    toValue a3
    a3, a4 -> Value
    forall a. IsValue a => a -> Value
    toValue a4
    a4, a5 -> Value
    forall a. IsValue a => a -> Value
    toValue a5
    a5, a6 -> Value
    forall a. IsValue a => a -> Value
    toValue a6
    a6, a7 -> Value
    forall a. IsValue a => a -> Value
    toValue a7
    a7]
        fromValue :: Value -> Maybe (a1, a2, a3, a4, a5, a6, a7)
    fromValue (ValueStructure [Value
    a1, Value
    a2, Value
    a3, Value
    a4, Value
    a5, Value
    a6, Value
    a7]) = do
            a1' <- Value -> Maybe a1
    forall a. IsValue a => Value -> Maybe a
    fromValue Value
    a1
            a2' <- fromValue a2
            a3' <- fromValue a3
            a4' <- fromValue a4
            a5' <- fromValue a5
            a6' <- fromValue a6
            a7' <- fromValue a7
            return (a1', a2', a3', a4', a5', a6', a7')
        fromValue Value
    _ = Maybe (a1, a2, a3, a4, a5, a6, a7)
    forall a. Maybe a
    Nothing

    instance (IsValue a1, IsValue a2, IsValue a3, IsValue a4, IsValue a5, IsValue a6, IsValue a7, IsValue a8) => IsValue (a1, a2, a3, a4, a5, a6, a7, a8) where
        typeOf_ :: Proxy (a1, a2, a3, a4, a5, a6, a7, a8) -> Type
    typeOf_ Proxy (a1, a2, a3, a4, a5, a6, a7, a8)
    _ = [Type] -> Type
    TypeStructure
            [ Proxy a1 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a1
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a1)
            , Proxy a2 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a2
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a2)
            , Proxy a3 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a3
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a3)
            , Proxy a4 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a4
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a4)
            , Proxy a5 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a5
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a5)
            , Proxy a6 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a6
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a6)
            , Proxy a7 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a7
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a7)
            , Proxy a8 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a8
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a8)
            ]
        toValue :: (a1, a2, a3, a4, a5, a6, a7, a8) -> Value
    toValue (a1
    a1, a2
    a2, a3
    a3, a4
    a4, a5
    a5, a6
    a6, a7
    a7, a8
    a8) = [Value] -> Value
    ValueStructure [a1 -> Value
    forall a. IsValue a => a -> Value
    toValue a1
    a1, a2 -> Value
    forall a. IsValue a => a -> Value
    toValue a2
    a2, a3 -> Value
    forall a. IsValue a => a -> Value
    toValue a3
    a3, a4 -> Value
    forall a. IsValue a => a -> Value
    toValue a4
    a4, a5 -> Value
    forall a. IsValue a => a -> Value
    toValue a5
    a5, a6 -> Value
    forall a. IsValue a => a -> Value
    toValue a6
    a6, a7 -> Value
    forall a. IsValue a => a -> Value
    toValue a7
    a7, a8 -> Value
    forall a. IsValue a => a -> Value
    toValue a8
    a8]
        fromValue :: Value -> Maybe (a1, a2, a3, a4, a5, a6, a7, a8)
    fromValue (ValueStructure [Value
    a1, Value
    a2, Value
    a3, Value
    a4, Value
    a5, Value
    a6, Value
    a7, Value
    a8]) = do
            a1' <- Value -> Maybe a1
    forall a. IsValue a => Value -> Maybe a
    fromValue Value
    a1
            a2' <- fromValue a2
            a3' <- fromValue a3
            a4' <- fromValue a4
            a5' <- fromValue a5
            a6' <- fromValue a6
            a7' <- fromValue a7
            a8' <- fromValue a8
            return (a1', a2', a3', a4', a5', a6', a7', a8')
        fromValue Value
    _ = Maybe (a1, a2, a3, a4, a5, a6, a7, a8)
    forall a. Maybe a
    Nothing

    instance (IsValue a1, IsValue a2, IsValue a3, IsValue a4, IsValue a5, IsValue a6, IsValue a7, IsValue a8, IsValue a9) => IsValue (a1, a2, a3, a4, a5, a6, a7, a8, a9) where
        typeOf_ :: Proxy (a1, a2, a3, a4, a5, a6, a7, a8, a9) -> Type
    typeOf_ Proxy (a1, a2, a3, a4, a5, a6, a7, a8, a9)
    _ = [Type] -> Type
    TypeStructure
            [ Proxy a1 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a1
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a1)
            , Proxy a2 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a2
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a2)
            , Proxy a3 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a3
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a3)
            , Proxy a4 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a4
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a4)
            , Proxy a5 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a5
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a5)
            , Proxy a6 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a6
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a6)
            , Proxy a7 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a7
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a7)
            , Proxy a8 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a8
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a8)
            , Proxy a9 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a9
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a9)
            ]
        toValue :: (a1, a2, a3, a4, a5, a6, a7, a8, a9) -> Value
    toValue (a1
    a1, a2
    a2, a3
    a3, a4
    a4, a5
    a5, a6
    a6, a7
    a7, a8
    a8, a9
    a9) = [Value] -> Value
    ValueStructure [a1 -> Value
    forall a. IsValue a => a -> Value
    toValue a1
    a1, a2 -> Value
    forall a. IsValue a => a -> Value
    toValue a2
    a2, a3 -> Value
    forall a. IsValue a => a -> Value
    toValue a3
    a3, a4 -> Value
    forall a. IsValue a => a -> Value
    toValue a4
    a4, a5 -> Value
    forall a. IsValue a => a -> Value
    toValue a5
    a5, a6 -> Value
    forall a. IsValue a => a -> Value
    toValue a6
    a6, a7 -> Value
    forall a. IsValue a => a -> Value
    toValue a7
    a7, a8 -> Value
    forall a. IsValue a => a -> Value
    toValue a8
    a8, a9 -> Value
    forall a. IsValue a => a -> Value
    toValue a9
    a9]
        fromValue :: Value -> Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9)
    fromValue (ValueStructure [Value
    a1, Value
    a2, Value
    a3, Value
    a4, Value
    a5, Value
    a6, Value
    a7, Value
    a8, Value
    a9]) = do
            a1' <- Value -> Maybe a1
    forall a. IsValue a => Value -> Maybe a
    fromValue Value
    a1
            a2' <- fromValue a2
            a3' <- fromValue a3
            a4' <- fromValue a4
            a5' <- fromValue a5
            a6' <- fromValue a6
            a7' <- fromValue a7
            a8' <- fromValue a8
            a9' <- fromValue a9
            return (a1', a2', a3', a4', a5', a6', a7', a8', a9')
        fromValue Value
    _ = Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9)
    forall a. Maybe a
    Nothing

    instance (IsValue a1, IsValue a2, IsValue a3, IsValue a4, IsValue a5, IsValue a6, IsValue a7, IsValue a8, IsValue a9, IsValue a10) => IsValue (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) where
        typeOf_ :: Proxy (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) -> Type
    typeOf_ Proxy (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
    _ = [Type] -> Type
    TypeStructure
            [ Proxy a1 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a1
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a1)
            , Proxy a2 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a2
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a2)
            , Proxy a3 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a3
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a3)
            , Proxy a4 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a4
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a4)
            , Proxy a5 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a5
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a5)
            , Proxy a6 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a6
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a6)
            , Proxy a7 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a7
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a7)
            , Proxy a8 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a8
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a8)
            , Proxy a9 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a9
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a9)
            , Proxy a10 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a10
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a10)
            ]
        toValue :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) -> Value
    toValue (a1
    a1, a2
    a2, a3
    a3, a4
    a4, a5
    a5, a6
    a6, a7
    a7, a8
    a8, a9
    a9, a10
    a10) = [Value] -> Value
    ValueStructure [a1 -> Value
    forall a. IsValue a => a -> Value
    toValue a1
    a1, a2 -> Value
    forall a. IsValue a => a -> Value
    toValue a2
    a2, a3 -> Value
    forall a. IsValue a => a -> Value
    toValue a3
    a3, a4 -> Value
    forall a. IsValue a => a -> Value
    toValue a4
    a4, a5 -> Value
    forall a. IsValue a => a -> Value
    toValue a5
    a5, a6 -> Value
    forall a. IsValue a => a -> Value
    toValue a6
    a6, a7 -> Value
    forall a. IsValue a => a -> Value
    toValue a7
    a7, a8 -> Value
    forall a. IsValue a => a -> Value
    toValue a8
    a8, a9 -> Value
    forall a. IsValue a => a -> Value
    toValue a9
    a9, a10 -> Value
    forall a. IsValue a => a -> Value
    toValue a10
    a10]
        fromValue :: Value -> Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
    fromValue (ValueStructure [Value
    a1, Value
    a2, Value
    a3, Value
    a4, Value
    a5, Value
    a6, Value
    a7, Value
    a8, Value
    a9, Value
    a10]) = do
            a1' <- Value -> Maybe a1
    forall a. IsValue a => Value -> Maybe a
    fromValue Value
    a1
            a2' <- fromValue a2
            a3' <- fromValue a3
            a4' <- fromValue a4
            a5' <- fromValue a5
            a6' <- fromValue a6
            a7' <- fromValue a7
            a8' <- fromValue a8
            a9' <- fromValue a9
            a10' <- fromValue a10
            return (a1', a2', a3', a4', a5', a6', a7', a8', a9', a10')
        fromValue Value
    _ = Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
    forall a. Maybe a
    Nothing

    instance (IsValue a1, IsValue a2, IsValue a3, IsValue a4, IsValue a5, IsValue a6, IsValue a7, IsValue a8, IsValue a9, IsValue a10, IsValue a11) => IsValue (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) where
        typeOf_ :: Proxy (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) -> Type
    typeOf_ Proxy (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11)
    _ = [Type] -> Type
    TypeStructure
            [ Proxy a1 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a1
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a1)
            , Proxy a2 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a2
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a2)
            , Proxy a3 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a3
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a3)
            , Proxy a4 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a4
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a4)
            , Proxy a5 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a5
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a5)
            , Proxy a6 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a6
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a6)
            , Proxy a7 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a7
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a7)
            , Proxy a8 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a8
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a8)
            , Proxy a9 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a9
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a9)
            , Proxy a10 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a10
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a10)
            , Proxy a11 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a11
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a11)
            ]
        toValue :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) -> Value
    toValue (a1
    a1, a2
    a2, a3
    a3, a4
    a4, a5
    a5, a6
    a6, a7
    a7, a8
    a8, a9
    a9, a10
    a10, a11
    a11) = [Value] -> Value
    ValueStructure [a1 -> Value
    forall a. IsValue a => a -> Value
    toValue a1
    a1, a2 -> Value
    forall a. IsValue a => a -> Value
    toValue a2
    a2, a3 -> Value
    forall a. IsValue a => a -> Value
    toValue a3
    a3, a4 -> Value
    forall a. IsValue a => a -> Value
    toValue a4
    a4, a5 -> Value
    forall a. IsValue a => a -> Value
    toValue a5
    a5, a6 -> Value
    forall a. IsValue a => a -> Value
    toValue a6
    a6, a7 -> Value
    forall a. IsValue a => a -> Value
    toValue a7
    a7, a8 -> Value
    forall a. IsValue a => a -> Value
    toValue a8
    a8, a9 -> Value
    forall a. IsValue a => a -> Value
    toValue a9
    a9, a10 -> Value
    forall a. IsValue a => a -> Value
    toValue a10
    a10, a11 -> Value
    forall a. IsValue a => a -> Value
    toValue a11
    a11]
        fromValue :: Value -> Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11)
    fromValue (ValueStructure [Value
    a1, Value
    a2, Value
    a3, Value
    a4, Value
    a5, Value
    a6, Value
    a7, Value
    a8, Value
    a9, Value
    a10, Value
    a11]) = do
            a1' <- Value -> Maybe a1
    forall a. IsValue a => Value -> Maybe a
    fromValue Value
    a1
            a2' <- fromValue a2
            a3' <- fromValue a3
            a4' <- fromValue a4
            a5' <- fromValue a5
            a6' <- fromValue a6
            a7' <- fromValue a7
            a8' <- fromValue a8
            a9' <- fromValue a9
            a10' <- fromValue a10
            a11' <- fromValue a11
            return (a1', a2', a3', a4', a5', a6', a7', a8', a9', a10', a11')
        fromValue Value
    _ = Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11)
    forall a. Maybe a
    Nothing

    instance (IsValue a1, IsValue a2, IsValue a3, IsValue a4, IsValue a5, IsValue a6, IsValue a7, IsValue a8, IsValue a9, IsValue a10, IsValue a11, IsValue a12) => IsValue (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) where
        typeOf_ :: Proxy (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) -> Type
    typeOf_ Proxy (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12)
    _ = [Type] -> Type
    TypeStructure
            [ Proxy a1 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a1
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a1)
            , Proxy a2 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a2
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a2)
            , Proxy a3 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a3
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a3)
            , Proxy a4 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a4
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a4)
            , Proxy a5 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a5
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a5)
            , Proxy a6 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a6
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a6)
            , Proxy a7 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a7
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a7)
            , Proxy a8 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a8
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a8)
            , Proxy a9 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a9
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a9)
            , Proxy a10 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a10
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a10)
            , Proxy a11 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a11
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a11)
            , Proxy a12 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a12
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a12)
            ]
        toValue :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) -> Value
    toValue (a1
    a1, a2
    a2, a3
    a3, a4
    a4, a5
    a5, a6
    a6, a7
    a7, a8
    a8, a9
    a9, a10
    a10, a11
    a11, a12
    a12) = [Value] -> Value
    ValueStructure [a1 -> Value
    forall a. IsValue a => a -> Value
    toValue a1
    a1, a2 -> Value
    forall a. IsValue a => a -> Value
    toValue a2
    a2, a3 -> Value
    forall a. IsValue a => a -> Value
    toValue a3
    a3, a4 -> Value
    forall a. IsValue a => a -> Value
    toValue a4
    a4, a5 -> Value
    forall a. IsValue a => a -> Value
    toValue a5
    a5, a6 -> Value
    forall a. IsValue a => a -> Value
    toValue a6
    a6, a7 -> Value
    forall a. IsValue a => a -> Value
    toValue a7
    a7, a8 -> Value
    forall a. IsValue a => a -> Value
    toValue a8
    a8, a9 -> Value
    forall a. IsValue a => a -> Value
    toValue a9
    a9, a10 -> Value
    forall a. IsValue a => a -> Value
    toValue a10
    a10, a11 -> Value
    forall a. IsValue a => a -> Value
    toValue a11
    a11, a12 -> Value
    forall a. IsValue a => a -> Value
    toValue a12
    a12]
        fromValue :: Value -> Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12)
    fromValue (ValueStructure [Value
    a1, Value
    a2, Value
    a3, Value
    a4, Value
    a5, Value
    a6, Value
    a7, Value
    a8, Value
    a9, Value
    a10, Value
    a11, Value
    a12]) = do
            a1' <- Value -> Maybe a1
    forall a. IsValue a => Value -> Maybe a
    fromValue Value
    a1
            a2' <- fromValue a2
            a3' <- fromValue a3
            a4' <- fromValue a4
            a5' <- fromValue a5
            a6' <- fromValue a6
            a7' <- fromValue a7
            a8' <- fromValue a8
            a9' <- fromValue a9
            a10' <- fromValue a10
            a11' <- fromValue a11
            a12' <- fromValue a12
            return (a1', a2', a3', a4', a5', a6', a7', a8', a9', a10', a11', a12')
        fromValue Value
    _ = Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12)
    forall a. Maybe a
    Nothing

    instance (IsValue a1, IsValue a2, IsValue a3, IsValue a4, IsValue a5, IsValue a6, IsValue a7, IsValue a8, IsValue a9, IsValue a10, IsValue a11, IsValue a12, IsValue a13) => IsValue (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) where
        typeOf_ :: Proxy (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13)
    -> Type
    typeOf_ Proxy (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13)
    _ = [Type] -> Type
    TypeStructure
            [ Proxy a1 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a1
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a1)
            , Proxy a2 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a2
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a2)
            , Proxy a3 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a3
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a3)
            , Proxy a4 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a4
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a4)
            , Proxy a5 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a5
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a5)
            , Proxy a6 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a6
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a6)
            , Proxy a7 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a7
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a7)
            , Proxy a8 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a8
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a8)
            , Proxy a9 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a9
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a9)
            , Proxy a10 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a10
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a10)
            , Proxy a11 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a11
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a11)
            , Proxy a12 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a12
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a12)
            , Proxy a13 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a13
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a13)
            ]
        toValue :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) -> Value
    toValue (a1
    a1, a2
    a2, a3
    a3, a4
    a4, a5
    a5, a6
    a6, a7
    a7, a8
    a8, a9
    a9, a10
    a10, a11
    a11, a12
    a12, a13
    a13) = [Value] -> Value
    ValueStructure [a1 -> Value
    forall a. IsValue a => a -> Value
    toValue a1
    a1, a2 -> Value
    forall a. IsValue a => a -> Value
    toValue a2
    a2, a3 -> Value
    forall a. IsValue a => a -> Value
    toValue a3
    a3, a4 -> Value
    forall a. IsValue a => a -> Value
    toValue a4
    a4, a5 -> Value
    forall a. IsValue a => a -> Value
    toValue a5
    a5, a6 -> Value
    forall a. IsValue a => a -> Value
    toValue a6
    a6, a7 -> Value
    forall a. IsValue a => a -> Value
    toValue a7
    a7, a8 -> Value
    forall a. IsValue a => a -> Value
    toValue a8
    a8, a9 -> Value
    forall a. IsValue a => a -> Value
    toValue a9
    a9, a10 -> Value
    forall a. IsValue a => a -> Value
    toValue a10
    a10, a11 -> Value
    forall a. IsValue a => a -> Value
    toValue a11
    a11, a12 -> Value
    forall a. IsValue a => a -> Value
    toValue a12
    a12, a13 -> Value
    forall a. IsValue a => a -> Value
    toValue a13
    a13]
        fromValue :: Value
    -> Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13)
    fromValue (ValueStructure [Value
    a1, Value
    a2, Value
    a3, Value
    a4, Value
    a5, Value
    a6, Value
    a7, Value
    a8, Value
    a9, Value
    a10, Value
    a11, Value
    a12, Value
    a13]) = do
            a1' <- Value -> Maybe a1
    forall a. IsValue a => Value -> Maybe a
    fromValue Value
    a1
            a2' <- fromValue a2
            a3' <- fromValue a3
            a4' <- fromValue a4
            a5' <- fromValue a5
            a6' <- fromValue a6
            a7' <- fromValue a7
            a8' <- fromValue a8
            a9' <- fromValue a9
            a10' <- fromValue a10
            a11' <- fromValue a11
            a12' <- fromValue a12
            a13' <- fromValue a13
            return (a1', a2', a3', a4', a5', a6', a7', a8', a9', a10', a11', a12', a13')
        fromValue Value
    _ = Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13)
    forall a. Maybe a
    Nothing

    instance (IsValue a1, IsValue a2, IsValue a3, IsValue a4, IsValue a5, IsValue a6, IsValue a7, IsValue a8, IsValue a9, IsValue a10, IsValue a11, IsValue a12, IsValue a13, IsValue a14) => IsValue (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) where
        typeOf_ :: Proxy (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14)
    -> Type
    typeOf_ Proxy (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14)
    _ = [Type] -> Type
    TypeStructure
            [ Proxy a1 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a1
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a1)
            , Proxy a2 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a2
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a2)
            , Proxy a3 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a3
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a3)
            , Proxy a4 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a4
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a4)
            , Proxy a5 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a5
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a5)
            , Proxy a6 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a6
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a6)
            , Proxy a7 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a7
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a7)
            , Proxy a8 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a8
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a8)
            , Proxy a9 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a9
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a9)
            , Proxy a10 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a10
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a10)
            , Proxy a11 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a11
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a11)
            , Proxy a12 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a12
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a12)
            , Proxy a13 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a13
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a13)
            , Proxy a14 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a14
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a14)
            ]
        toValue :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14)
    -> Value
    toValue (a1
    a1, a2
    a2, a3
    a3, a4
    a4, a5
    a5, a6
    a6, a7
    a7, a8
    a8, a9
    a9, a10
    a10, a11
    a11, a12
    a12, a13
    a13, a14
    a14) = [Value] -> Value
    ValueStructure [a1 -> Value
    forall a. IsValue a => a -> Value
    toValue a1
    a1, a2 -> Value
    forall a. IsValue a => a -> Value
    toValue a2
    a2, a3 -> Value
    forall a. IsValue a => a -> Value
    toValue a3
    a3, a4 -> Value
    forall a. IsValue a => a -> Value
    toValue a4
    a4, a5 -> Value
    forall a. IsValue a => a -> Value
    toValue a5
    a5, a6 -> Value
    forall a. IsValue a => a -> Value
    toValue a6
    a6, a7 -> Value
    forall a. IsValue a => a -> Value
    toValue a7
    a7, a8 -> Value
    forall a. IsValue a => a -> Value
    toValue a8
    a8, a9 -> Value
    forall a. IsValue a => a -> Value
    toValue a9
    a9, a10 -> Value
    forall a. IsValue a => a -> Value
    toValue a10
    a10, a11 -> Value
    forall a. IsValue a => a -> Value
    toValue a11
    a11, a12 -> Value
    forall a. IsValue a => a -> Value
    toValue a12
    a12, a13 -> Value
    forall a. IsValue a => a -> Value
    toValue a13
    a13, a14 -> Value
    forall a. IsValue a => a -> Value
    toValue a14
    a14]
        fromValue :: Value
    -> Maybe
         (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14)
    fromValue (ValueStructure [Value
    a1, Value
    a2, Value
    a3, Value
    a4, Value
    a5, Value
    a6, Value
    a7, Value
    a8, Value
    a9, Value
    a10, Value
    a11, Value
    a12, Value
    a13, Value
    a14]) = do
            a1' <- Value -> Maybe a1
    forall a. IsValue a => Value -> Maybe a
    fromValue Value
    a1
            a2' <- fromValue a2
            a3' <- fromValue a3
            a4' <- fromValue a4
            a5' <- fromValue a5
            a6' <- fromValue a6
            a7' <- fromValue a7
            a8' <- fromValue a8
            a9' <- fromValue a9
            a10' <- fromValue a10
            a11' <- fromValue a11
            a12' <- fromValue a12
            a13' <- fromValue a13
            a14' <- fromValue a14
            return (a1', a2', a3', a4', a5', a6', a7', a8', a9', a10', a11', a12', a13', a14')
        fromValue Value
    _ = Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14)
    forall a. Maybe a
    Nothing

    instance (IsValue a1, IsValue a2, IsValue a3, IsValue a4, IsValue a5, IsValue a6, IsValue a7, IsValue a8, IsValue a9, IsValue a10, IsValue a11, IsValue a12, IsValue a13, IsValue a14, IsValue a15) => IsValue (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) where
        typeOf_ :: Proxy
      (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15)
    -> Type
    typeOf_ Proxy
      (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15)
    _ = [Type] -> Type
    TypeStructure
            [ Proxy a1 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a1
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a1)
            , Proxy a2 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a2
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a2)
            , Proxy a3 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a3
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a3)
            , Proxy a4 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a4
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a4)
            , Proxy a5 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a5
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a5)
            , Proxy a6 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a6
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a6)
            , Proxy a7 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a7
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a7)
            , Proxy a8 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a8
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a8)
            , Proxy a9 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a9
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a9)
            , Proxy a10 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a10
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a10)
            , Proxy a11 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a11
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a11)
            , Proxy a12 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a12
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a12)
            , Proxy a13 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a13
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a13)
            , Proxy a14 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a14
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a14)
            , Proxy a15 -> Type
    forall a. IsValue a => Proxy a -> Type
    typeOf_ (Proxy a15
    forall {k} (t :: k). Proxy t
    Proxy :: Proxy a15)
            ]
        toValue :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15)
    -> Value
    toValue (a1
    a1, a2
    a2, a3
    a3, a4
    a4, a5
    a5, a6
    a6, a7
    a7, a8
    a8, a9
    a9, a10
    a10, a11
    a11, a12
    a12, a13
    a13, a14
    a14, a15
    a15) = [Value] -> Value
    ValueStructure [a1 -> Value
    forall a. IsValue a => a -> Value
    toValue a1
    a1, a2 -> Value
    forall a. IsValue a => a -> Value
    toValue a2
    a2, a3 -> Value
    forall a. IsValue a => a -> Value
    toValue a3
    a3, a4 -> Value
    forall a. IsValue a => a -> Value
    toValue a4
    a4, a5 -> Value
    forall a. IsValue a => a -> Value
    toValue a5
    a5, a6 -> Value
    forall a. IsValue a => a -> Value
    toValue a6
    a6, a7 -> Value
    forall a. IsValue a => a -> Value
    toValue a7
    a7, a8 -> Value
    forall a. IsValue a => a -> Value
    toValue a8
    a8, a9 -> Value
    forall a. IsValue a => a -> Value
    toValue a9
    a9, a10 -> Value
    forall a. IsValue a => a -> Value
    toValue a10
    a10, a11 -> Value
    forall a. IsValue a => a -> Value
    toValue a11
    a11, a12 -> Value
    forall a. IsValue a => a -> Value
    toValue a12
    a12, a13 -> Value
    forall a. IsValue a => a -> Value
    toValue a13
    a13, a14 -> Value
    forall a. IsValue a => a -> Value
    toValue a14
    a14, a15 -> Value
    forall a. IsValue a => a -> Value
    toValue a15
    a15]
        fromValue :: Value
    -> Maybe
         (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15)
    fromValue (ValueStructure [Value
    a1, Value
    a2, Value
    a3, Value
    a4, Value
    a5, Value
    a6, Value
    a7, Value
    a8, Value
    a9, Value
    a10, Value
    a11, Value
    a12, Value
    a13, Value
    a14, Value
    a15]) = do
            a1' <- Value -> Maybe a1
    forall a. IsValue a => Value -> Maybe a
    fromValue Value
    a1
            a2' <- fromValue a2
            a3' <- fromValue a3
            a4' <- fromValue a4
            a5' <- fromValue a5
            a6' <- fromValue a6
            a7' <- fromValue a7
            a8' <- fromValue a8
            a9' <- fromValue a9
            a10' <- fromValue a10
            a11' <- fromValue a11
            a12' <- fromValue a12
            a13' <- fromValue a13
            a14' <- fromValue a14
            a15' <- fromValue a15
            return (a1', a2', a3', a4', a5', a6', a7', a8', a9', a10', a11', a12', a13', a14', a15')
        fromValue Value
    _ = Maybe
      (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15)
    forall a. Maybe a
    Nothing

    instance (IsVariant a1, IsVariant a2, IsVariant a3) => IsVariant (a1, a2, a3) where
        toVariant :: (a1, a2, a3) -> Variant
    toVariant (a1
    a1, a2
    a2, a3
    a3) = Value -> Variant
    Variant ([Value] -> Value
    ValueStructure [a1 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a1
    a1, a2 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a2
    a2, a3 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a3
    a3])
        fromVariant :: Variant -> Maybe (a1, a2, a3)
    fromVariant (Variant (ValueStructure [Value
    a1, Value
    a2, Value
    a3])) = do
            a1' <- (Variant -> Maybe a1
    forall a. IsVariant a => Variant -> Maybe a
    fromVariant (Variant -> Maybe a1) -> (Value -> Variant) -> Value -> Maybe a1
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Value -> Variant
    Variant) Value
    a1
            a2' <- (fromVariant . Variant) a2
            a3' <- (fromVariant . Variant) a3
            return (a1', a2', a3')
        fromVariant Variant
    _ = Maybe (a1, a2, a3)
    forall a. Maybe a
    Nothing

    instance (IsVariant a1, IsVariant a2, IsVariant a3, IsVariant a4) => IsVariant (a1, a2, a3, a4) where
        toVariant :: (a1, a2, a3, a4) -> Variant
    toVariant (a1
    a1, a2
    a2, a3
    a3, a4
    a4) = Value -> Variant
    Variant ([Value] -> Value
    ValueStructure [a1 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a1
    a1, a2 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a2
    a2, a3 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a3
    a3, a4 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a4
    a4])
        fromVariant :: Variant -> Maybe (a1, a2, a3, a4)
    fromVariant (Variant (ValueStructure [Value
    a1, Value
    a2, Value
    a3, Value
    a4])) = do
            a1' <- (Variant -> Maybe a1
    forall a. IsVariant a => Variant -> Maybe a
    fromVariant (Variant -> Maybe a1) -> (Value -> Variant) -> Value -> Maybe a1
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Value -> Variant
    Variant) Value
    a1
            a2' <- (fromVariant . Variant) a2
            a3' <- (fromVariant . Variant) a3
            a4' <- (fromVariant . Variant) a4
            return (a1', a2', a3', a4')
        fromVariant Variant
    _ = Maybe (a1, a2, a3, a4)
    forall a. Maybe a
    Nothing

    instance (IsVariant a1, IsVariant a2, IsVariant a3, IsVariant a4, IsVariant a5) => IsVariant (a1, a2, a3, a4, a5) where
        toVariant :: (a1, a2, a3, a4, a5) -> Variant
    toVariant (a1
    a1, a2
    a2, a3
    a3, a4
    a4, a5
    a5) = Value -> Variant
    Variant ([Value] -> Value
    ValueStructure [a1 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a1
    a1, a2 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a2
    a2, a3 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a3
    a3, a4 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a4
    a4, a5 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a5
    a5])
        fromVariant :: Variant -> Maybe (a1, a2, a3, a4, a5)
    fromVariant (Variant (ValueStructure [Value
    a1, Value
    a2, Value
    a3, Value
    a4, Value
    a5])) = do
            a1' <- (Variant -> Maybe a1
    forall a. IsVariant a => Variant -> Maybe a
    fromVariant (Variant -> Maybe a1) -> (Value -> Variant) -> Value -> Maybe a1
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Value -> Variant
    Variant) Value
    a1
            a2' <- (fromVariant . Variant) a2
            a3' <- (fromVariant . Variant) a3
            a4' <- (fromVariant . Variant) a4
            a5' <- (fromVariant . Variant) a5
            return (a1', a2', a3', a4', a5')
        fromVariant Variant
    _ = Maybe (a1, a2, a3, a4, a5)
    forall a. Maybe a
    Nothing

    instance (IsVariant a1, IsVariant a2, IsVariant a3, IsVariant a4, IsVariant a5, IsVariant a6) => IsVariant (a1, a2, a3, a4, a5, a6) where
        toVariant :: (a1, a2, a3, a4, a5, a6) -> Variant
    toVariant (a1
    a1, a2
    a2, a3
    a3, a4
    a4, a5
    a5, a6
    a6) = Value -> Variant
    Variant ([Value] -> Value
    ValueStructure [a1 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a1
    a1, a2 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a2
    a2, a3 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a3
    a3, a4 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a4
    a4, a5 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a5
    a5, a6 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a6
    a6])
        fromVariant :: Variant -> Maybe (a1, a2, a3, a4, a5, a6)
    fromVariant (Variant (ValueStructure [Value
    a1, Value
    a2, Value
    a3, Value
    a4, Value
    a5, Value
    a6])) = do
            a1' <- (Variant -> Maybe a1
    forall a. IsVariant a => Variant -> Maybe a
    fromVariant (Variant -> Maybe a1) -> (Value -> Variant) -> Value -> Maybe a1
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Value -> Variant
    Variant) Value
    a1
            a2' <- (fromVariant . Variant) a2
            a3' <- (fromVariant . Variant) a3
            a4' <- (fromVariant . Variant) a4
            a5' <- (fromVariant . Variant) a5
            a6' <- (fromVariant . Variant) a6
            return (a1', a2', a3', a4', a5', a6')
        fromVariant Variant
    _ = Maybe (a1, a2, a3, a4, a5, a6)
    forall a. Maybe a
    Nothing

    instance (IsVariant a1, IsVariant a2, IsVariant a3, IsVariant a4, IsVariant a5, IsVariant a6, IsVariant a7) => IsVariant (a1, a2, a3, a4, a5, a6, a7) where
        toVariant :: (a1, a2, a3, a4, a5, a6, a7) -> Variant
    toVariant (a1
    a1, a2
    a2, a3
    a3, a4
    a4, a5
    a5, a6
    a6, a7
    a7) = Value -> Variant
    Variant ([Value] -> Value
    ValueStructure [a1 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a1
    a1, a2 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a2
    a2, a3 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a3
    a3, a4 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a4
    a4, a5 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a5
    a5, a6 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a6
    a6, a7 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a7
    a7])
        fromVariant :: Variant -> Maybe (a1, a2, a3, a4, a5, a6, a7)
    fromVariant (Variant (ValueStructure [Value
    a1, Value
    a2, Value
    a3, Value
    a4, Value
    a5, Value
    a6, Value
    a7])) = do
            a1' <- (Variant -> Maybe a1
    forall a. IsVariant a => Variant -> Maybe a
    fromVariant (Variant -> Maybe a1) -> (Value -> Variant) -> Value -> Maybe a1
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Value -> Variant
    Variant) Value
    a1
            a2' <- (fromVariant . Variant) a2
            a3' <- (fromVariant . Variant) a3
            a4' <- (fromVariant . Variant) a4
            a5' <- (fromVariant . Variant) a5
            a6' <- (fromVariant . Variant) a6
            a7' <- (fromVariant . Variant) a7
            return (a1', a2', a3', a4', a5', a6', a7')
        fromVariant Variant
    _ = Maybe (a1, a2, a3, a4, a5, a6, a7)
    forall a. Maybe a
    Nothing

    instance (IsVariant a1, IsVariant a2, IsVariant a3, IsVariant a4, IsVariant a5, IsVariant a6, IsVariant a7, IsVariant a8) => IsVariant (a1, a2, a3, a4, a5, a6, a7, a8) where
        toVariant :: (a1, a2, a3, a4, a5, a6, a7, a8) -> Variant
    toVariant (a1
    a1, a2
    a2, a3
    a3, a4
    a4, a5
    a5, a6
    a6, a7
    a7, a8
    a8) = Value -> Variant
    Variant ([Value] -> Value
    ValueStructure [a1 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a1
    a1, a2 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a2
    a2, a3 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a3
    a3, a4 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a4
    a4, a5 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a5
    a5, a6 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a6
    a6, a7 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a7
    a7, a8 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a8
    a8])
        fromVariant :: Variant -> Maybe (a1, a2, a3, a4, a5, a6, a7, a8)
    fromVariant (Variant (ValueStructure [Value
    a1, Value
    a2, Value
    a3, Value
    a4, Value
    a5, Value
    a6, Value
    a7, Value
    a8])) = do
            a1' <- (Variant -> Maybe a1
    forall a. IsVariant a => Variant -> Maybe a
    fromVariant (Variant -> Maybe a1) -> (Value -> Variant) -> Value -> Maybe a1
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Value -> Variant
    Variant) Value
    a1
            a2' <- (fromVariant . Variant) a2
            a3' <- (fromVariant . Variant) a3
            a4' <- (fromVariant . Variant) a4
            a5' <- (fromVariant . Variant) a5
            a6' <- (fromVariant . Variant) a6
            a7' <- (fromVariant . Variant) a7
            a8' <- (fromVariant . Variant) a8
            return (a1', a2', a3', a4', a5', a6', a7', a8')
        fromVariant Variant
    _ = Maybe (a1, a2, a3, a4, a5, a6, a7, a8)
    forall a. Maybe a
    Nothing

    instance (IsVariant a1, IsVariant a2, IsVariant a3, IsVariant a4, IsVariant a5, IsVariant a6, IsVariant a7, IsVariant a8, IsVariant a9) => IsVariant (a1, a2, a3, a4, a5, a6, a7, a8, a9) where
        toVariant :: (a1, a2, a3, a4, a5, a6, a7, a8, a9) -> Variant
    toVariant (a1
    a1, a2
    a2, a3
    a3, a4
    a4, a5
    a5, a6
    a6, a7
    a7, a8
    a8, a9
    a9) = Value -> Variant
    Variant ([Value] -> Value
    ValueStructure [a1 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a1
    a1, a2 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a2
    a2, a3 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a3
    a3, a4 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a4
    a4, a5 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a5
    a5, a6 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a6
    a6, a7 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a7
    a7, a8 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a8
    a8, a9 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a9
    a9])
        fromVariant :: Variant -> Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9)
    fromVariant (Variant (ValueStructure [Value
    a1, Value
    a2, Value
    a3, Value
    a4, Value
    a5, Value
    a6, Value
    a7, Value
    a8, Value
    a9])) = do
            a1' <- (Variant -> Maybe a1
    forall a. IsVariant a => Variant -> Maybe a
    fromVariant (Variant -> Maybe a1) -> (Value -> Variant) -> Value -> Maybe a1
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Value -> Variant
    Variant) Value
    a1
            a2' <- (fromVariant . Variant) a2
            a3' <- (fromVariant . Variant) a3
            a4' <- (fromVariant . Variant) a4
            a5' <- (fromVariant . Variant) a5
            a6' <- (fromVariant . Variant) a6
            a7' <- (fromVariant . Variant) a7
            a8' <- (fromVariant . Variant) a8
            a9' <- (fromVariant . Variant) a9
            return (a1', a2', a3', a4', a5', a6', a7', a8', a9')
        fromVariant Variant
    _ = Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9)
    forall a. Maybe a
    Nothing

    instance (IsVariant a1, IsVariant a2, IsVariant a3, IsVariant a4, IsVariant a5, IsVariant a6, IsVariant a7, IsVariant a8, IsVariant a9, IsVariant a10) => IsVariant (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) where
        toVariant :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) -> Variant
    toVariant (a1
    a1, a2
    a2, a3
    a3, a4
    a4, a5
    a5, a6
    a6, a7
    a7, a8
    a8, a9
    a9, a10
    a10) = Value -> Variant
    Variant ([Value] -> Value
    ValueStructure [a1 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a1
    a1, a2 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a2
    a2, a3 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a3
    a3, a4 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a4
    a4, a5 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a5
    a5, a6 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a6
    a6, a7 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a7
    a7, a8 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a8
    a8, a9 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a9
    a9, a10 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a10
    a10])
        fromVariant :: Variant -> Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
    fromVariant (Variant (ValueStructure [Value
    a1, Value
    a2, Value
    a3, Value
    a4, Value
    a5, Value
    a6, Value
    a7, Value
    a8, Value
    a9, Value
    a10])) = do
            a1' <- (Variant -> Maybe a1
    forall a. IsVariant a => Variant -> Maybe a
    fromVariant (Variant -> Maybe a1) -> (Value -> Variant) -> Value -> Maybe a1
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Value -> Variant
    Variant) Value
    a1
            a2' <- (fromVariant . Variant) a2
            a3' <- (fromVariant . Variant) a3
            a4' <- (fromVariant . Variant) a4
            a5' <- (fromVariant . Variant) a5
            a6' <- (fromVariant . Variant) a6
            a7' <- (fromVariant . Variant) a7
            a8' <- (fromVariant . Variant) a8
            a9' <- (fromVariant . Variant) a9
            a10' <- (fromVariant . Variant) a10
            return (a1', a2', a3', a4', a5', a6', a7', a8', a9', a10')
        fromVariant Variant
    _ = Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
    forall a. Maybe a
    Nothing

    instance (IsVariant a1, IsVariant a2, IsVariant a3, IsVariant a4, IsVariant a5, IsVariant a6, IsVariant a7, IsVariant a8, IsVariant a9, IsVariant a10, IsVariant a11) => IsVariant (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) where
        toVariant :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) -> Variant
    toVariant (a1
    a1, a2
    a2, a3
    a3, a4
    a4, a5
    a5, a6
    a6, a7
    a7, a8
    a8, a9
    a9, a10
    a10, a11
    a11) = Value -> Variant
    Variant ([Value] -> Value
    ValueStructure [a1 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a1
    a1, a2 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a2
    a2, a3 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a3
    a3, a4 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a4
    a4, a5 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a5
    a5, a6 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a6
    a6, a7 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a7
    a7, a8 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a8
    a8, a9 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a9
    a9, a10 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a10
    a10, a11 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a11
    a11])
        fromVariant :: Variant -> Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11)
    fromVariant (Variant (ValueStructure [Value
    a1, Value
    a2, Value
    a3, Value
    a4, Value
    a5, Value
    a6, Value
    a7, Value
    a8, Value
    a9, Value
    a10, Value
    a11])) = do
            a1' <- (Variant -> Maybe a1
    forall a. IsVariant a => Variant -> Maybe a
    fromVariant (Variant -> Maybe a1) -> (Value -> Variant) -> Value -> Maybe a1
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Value -> Variant
    Variant) Value
    a1
            a2' <- (fromVariant . Variant) a2
            a3' <- (fromVariant . Variant) a3
            a4' <- (fromVariant . Variant) a4
            a5' <- (fromVariant . Variant) a5
            a6' <- (fromVariant . Variant) a6
            a7' <- (fromVariant . Variant) a7
            a8' <- (fromVariant . Variant) a8
            a9' <- (fromVariant . Variant) a9
            a10' <- (fromVariant . Variant) a10
            a11' <- (fromVariant . Variant) a11
            return (a1', a2', a3', a4', a5', a6', a7', a8', a9', a10', a11')
        fromVariant Variant
    _ = Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11)
    forall a. Maybe a
    Nothing

    instance (IsVariant a1, IsVariant a2, IsVariant a3, IsVariant a4, IsVariant a5, IsVariant a6, IsVariant a7, IsVariant a8, IsVariant a9, IsVariant a10, IsVariant a11, IsVariant a12) => IsVariant (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) where
        toVariant :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) -> Variant
    toVariant (a1
    a1, a2
    a2, a3
    a3, a4
    a4, a5
    a5, a6
    a6, a7
    a7, a8
    a8, a9
    a9, a10
    a10, a11
    a11, a12
    a12) = Value -> Variant
    Variant ([Value] -> Value
    ValueStructure [a1 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a1
    a1, a2 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a2
    a2, a3 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a3
    a3, a4 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a4
    a4, a5 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a5
    a5, a6 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a6
    a6, a7 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a7
    a7, a8 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a8
    a8, a9 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a9
    a9, a10 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a10
    a10, a11 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a11
    a11, a12 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a12
    a12])
        fromVariant :: Variant
    -> Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12)
    fromVariant (Variant (ValueStructure [Value
    a1, Value
    a2, Value
    a3, Value
    a4, Value
    a5, Value
    a6, Value
    a7, Value
    a8, Value
    a9, Value
    a10, Value
    a11, Value
    a12])) = do
            a1' <- (Variant -> Maybe a1
    forall a. IsVariant a => Variant -> Maybe a
    fromVariant (Variant -> Maybe a1) -> (Value -> Variant) -> Value -> Maybe a1
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Value -> Variant
    Variant) Value
    a1
            a2' <- (fromVariant . Variant) a2
            a3' <- (fromVariant . Variant) a3
            a4' <- (fromVariant . Variant) a4
            a5' <- (fromVariant . Variant) a5
            a6' <- (fromVariant . Variant) a6
            a7' <- (fromVariant . Variant) a7
            a8' <- (fromVariant . Variant) a8
            a9' <- (fromVariant . Variant) a9
            a10' <- (fromVariant . Variant) a10
            a11' <- (fromVariant . Variant) a11
            a12' <- (fromVariant . Variant) a12
            return (a1', a2', a3', a4', a5', a6', a7', a8', a9', a10', a11', a12')
        fromVariant Variant
    _ = Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12)
    forall a. Maybe a
    Nothing

    instance (IsVariant a1, IsVariant a2, IsVariant a3, IsVariant a4, IsVariant a5, IsVariant a6, IsVariant a7, IsVariant a8, IsVariant a9, IsVariant a10, IsVariant a11, IsVariant a12, IsVariant a13) => IsVariant (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) where
        toVariant :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) -> Variant
    toVariant (a1
    a1, a2
    a2, a3
    a3, a4
    a4, a5
    a5, a6
    a6, a7
    a7, a8
    a8, a9
    a9, a10
    a10, a11
    a11, a12
    a12, a13
    a13) = Value -> Variant
    Variant ([Value] -> Value
    ValueStructure [a1 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a1
    a1, a2 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a2
    a2, a3 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a3
    a3, a4 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a4
    a4, a5 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a5
    a5, a6 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a6
    a6, a7 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a7
    a7, a8 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a8
    a8, a9 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a9
    a9, a10 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a10
    a10, a11 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a11
    a11, a12 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a12
    a12, a13 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a13
    a13])
        fromVariant :: Variant
    -> Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13)
    fromVariant (Variant (ValueStructure [Value
    a1, Value
    a2, Value
    a3, Value
    a4, Value
    a5, Value
    a6, Value
    a7, Value
    a8, Value
    a9, Value
    a10, Value
    a11, Value
    a12, Value
    a13])) = do
            a1' <- (Variant -> Maybe a1
    forall a. IsVariant a => Variant -> Maybe a
    fromVariant (Variant -> Maybe a1) -> (Value -> Variant) -> Value -> Maybe a1
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Value -> Variant
    Variant) Value
    a1
            a2' <- (fromVariant . Variant) a2
            a3' <- (fromVariant . Variant) a3
            a4' <- (fromVariant . Variant) a4
            a5' <- (fromVariant . Variant) a5
            a6' <- (fromVariant . Variant) a6
            a7' <- (fromVariant . Variant) a7
            a8' <- (fromVariant . Variant) a8
            a9' <- (fromVariant . Variant) a9
            a10' <- (fromVariant . Variant) a10
            a11' <- (fromVariant . Variant) a11
            a12' <- (fromVariant . Variant) a12
            a13' <- (fromVariant . Variant) a13
            return (a1', a2', a3', a4', a5', a6', a7', a8', a9', a10', a11', a12', a13')
        fromVariant Variant
    _ = Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13)
    forall a. Maybe a
    Nothing

    instance (IsVariant a1, IsVariant a2, IsVariant a3, IsVariant a4, IsVariant a5, IsVariant a6, IsVariant a7, IsVariant a8, IsVariant a9, IsVariant a10, IsVariant a11, IsVariant a12, IsVariant a13, IsVariant a14) => IsVariant (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) where
        toVariant :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14)
    -> Variant
    toVariant (a1
    a1, a2
    a2, a3
    a3, a4
    a4, a5
    a5, a6
    a6, a7
    a7, a8
    a8, a9
    a9, a10
    a10, a11
    a11, a12
    a12, a13
    a13, a14
    a14) = Value -> Variant
    Variant ([Value] -> Value
    ValueStructure [a1 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a1
    a1, a2 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a2
    a2, a3 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a3
    a3, a4 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a4
    a4, a5 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a5
    a5, a6 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a6
    a6, a7 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a7
    a7, a8 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a8
    a8, a9 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a9
    a9, a10 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a10
    a10, a11 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a11
    a11, a12 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a12
    a12, a13 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a13
    a13, a14 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a14
    a14])
        fromVariant :: Variant
    -> Maybe
         (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14)
    fromVariant (Variant (ValueStructure [Value
    a1, Value
    a2, Value
    a3, Value
    a4, Value
    a5, Value
    a6, Value
    a7, Value
    a8, Value
    a9, Value
    a10, Value
    a11, Value
    a12, Value
    a13, Value
    a14])) = do
            a1' <- (Variant -> Maybe a1
    forall a. IsVariant a => Variant -> Maybe a
    fromVariant (Variant -> Maybe a1) -> (Value -> Variant) -> Value -> Maybe a1
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Value -> Variant
    Variant) Value
    a1
            a2' <- (fromVariant . Variant) a2
            a3' <- (fromVariant . Variant) a3
            a4' <- (fromVariant . Variant) a4
            a5' <- (fromVariant . Variant) a5
            a6' <- (fromVariant . Variant) a6
            a7' <- (fromVariant . Variant) a7
            a8' <- (fromVariant . Variant) a8
            a9' <- (fromVariant . Variant) a9
            a10' <- (fromVariant . Variant) a10
            a11' <- (fromVariant . Variant) a11
            a12' <- (fromVariant . Variant) a12
            a13' <- (fromVariant . Variant) a13
            a14' <- (fromVariant . Variant) a14
            return (a1', a2', a3', a4', a5', a6', a7', a8', a9', a10', a11', a12', a13', a14')
        fromVariant Variant
    _ = Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14)
    forall a. Maybe a
    Nothing

    instance (IsVariant a1, IsVariant a2, IsVariant a3, IsVariant a4, IsVariant a5, IsVariant a6, IsVariant a7, IsVariant a8, IsVariant a9, IsVariant a10, IsVariant a11, IsVariant a12, IsVariant a13, IsVariant a14, IsVariant a15) => IsVariant (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) where
        toVariant :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15)
    -> Variant
    toVariant (a1
    a1, a2
    a2, a3
    a3, a4
    a4, a5
    a5, a6
    a6, a7
    a7, a8
    a8, a9
    a9, a10
    a10, a11
    a11, a12
    a12, a13
    a13, a14
    a14, a15
    a15) = Value -> Variant
    Variant ([Value] -> Value
    ValueStructure [a1 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a1
    a1, a2 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a2
    a2, a3 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a3
    a3, a4 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a4
    a4, a5 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a5
    a5, a6 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a6
    a6, a7 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a7
    a7, a8 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a8
    a8, a9 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a9
    a9, a10 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a10
    a10, a11 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a11
    a11, a12 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a12
    a12, a13 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a13
    a13, a14 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a14
    a14, a15 -> Value
    forall a. IsVariant a => a -> Value
    varToVal a15
    a15])
        fromVariant :: Variant
    -> Maybe
         (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15)
    fromVariant (Variant (ValueStructure [Value
    a1, Value
    a2, Value
    a3, Value
    a4, Value
    a5, Value
    a6, Value
    a7, Value
    a8, Value
    a9, Value
    a10, Value
    a11, Value
    a12, Value
    a13, Value
    a14, Value
    a15])) = do
            a1' <- (Variant -> Maybe a1
    forall a. IsVariant a => Variant -> Maybe a
    fromVariant (Variant -> Maybe a1) -> (Value -> Variant) -> Value -> Maybe a1
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Value -> Variant
    Variant) Value
    a1
            a2' <- (fromVariant . Variant) a2
            a3' <- (fromVariant . Variant) a3
            a4' <- (fromVariant . Variant) a4
            a5' <- (fromVariant . Variant) a5
            a6' <- (fromVariant . Variant) a6
            a7' <- (fromVariant . Variant) a7
            a8' <- (fromVariant . Variant) a8
            a9' <- (fromVariant . Variant) a9
            a10' <- (fromVariant . Variant) a10
            a11' <- (fromVariant . Variant) a11
            a12' <- (fromVariant . Variant) a12
            a13' <- (fromVariant . Variant) a13
            a14' <- (fromVariant . Variant) a14
            a15' <- (fromVariant . Variant) a15
            return (a1', a2', a3', a4', a5', a6', a7', a8', a9', a10', a11', a12', a13', a14', a15')
        fromVariant Variant
    _ = Maybe
      (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15)
    forall a. Maybe a
    Nothing

    -- | A value used to uniquely identify a particular message within a session.
    -- Serials are 32-bit unsigned integers, and eventually wrap.
    newtype Serial = Serial Word32
        deriving (Serial -> Serial -> Bool
    (Serial -> Serial -> Bool)
    -> (Serial -> Serial -> Bool) -> Eq Serial
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Serial -> Serial -> Bool
    == :: Serial -> Serial -> Bool
    $c/= :: Serial -> Serial -> Bool
    /= :: Serial -> Serial -> Bool
    Eq, Eq Serial
    Eq Serial =>
    (Serial -> Serial -> Ordering)
    -> (Serial -> Serial -> Bool)
    -> (Serial -> Serial -> Bool)
    -> (Serial -> Serial -> Bool)
    -> (Serial -> Serial -> Bool)
    -> (Serial -> Serial -> Serial)
    -> (Serial -> Serial -> Serial)
    -> Ord Serial
    Serial -> Serial -> Bool
    Serial -> Serial -> Ordering
    Serial -> Serial -> Serial
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: Serial -> Serial -> Ordering
    compare :: Serial -> Serial -> Ordering
    $c< :: Serial -> Serial -> Bool
    < :: Serial -> Serial -> Bool
    $c<= :: Serial -> Serial -> Bool
    <= :: Serial -> Serial -> Bool
    $c> :: Serial -> Serial -> Bool
    > :: Serial -> Serial -> Bool
    $c>= :: Serial -> Serial -> Bool
    >= :: Serial -> Serial -> Bool
    $cmax :: Serial -> Serial -> Serial
    max :: Serial -> Serial -> Serial
    $cmin :: Serial -> Serial -> Serial
    min :: Serial -> Serial -> Serial
    Ord, Int -> Serial -> ShowS
    [Serial] -> ShowS
    Serial -> String
    (Int -> Serial -> ShowS)
    -> (Serial -> String) -> ([Serial] -> ShowS) -> Show Serial
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> Serial -> ShowS
    showsPrec :: Int -> Serial -> ShowS
    $cshow :: Serial -> String
    show :: Serial -> String
    $cshowList :: [Serial] -> ShowS
    showList :: [Serial] -> ShowS
    Show)

    instance IsVariant Serial where
        toVariant :: Serial -> Variant
    toVariant (Serial Word32
    x) = Word32 -> Variant
    forall a. IsVariant a => a -> Variant
    toVariant Word32
    x
        fromVariant :: Variant -> Maybe Serial
    fromVariant = (Word32 -> Serial) -> Maybe Word32 -> Maybe Serial
    forall a b. (a -> b) -> Maybe a -> Maybe b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Word32 -> Serial
    Serial (Maybe Word32 -> Maybe Serial)
    -> (Variant -> Maybe Word32) -> Variant -> Maybe Serial
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Variant -> Maybe Word32
    forall a. IsVariant a => Variant -> Maybe a
    fromVariant

    serialValue :: Serial -> Word32
    serialValue :: Serial -> Word32
    serialValue (Serial Word32
    x) = Word32
    x

    -- | Get the first serial in the sequence.
    firstSerial :: Serial
    firstSerial :: Serial
    firstSerial = Word32 -> Serial
    Serial Word32
    1

    -- | Get the next serial in the sequence. This may wrap around to
    -- 'firstSerial'.
    nextSerial :: Serial -> Serial
    nextSerial :: Serial -> Serial
    nextSerial (Serial Word32
    x) = Word32 -> Serial
    Serial (if Word32
    x Word32 -> Word32 -> Word32
    forall a. Num a => a -> a -> a
    + Word32
    1 Word32 -> Word32 -> Bool
    forall a. Eq a => a -> a -> Bool
    == Word32
    0
        then Word32
    1 -- wrap to firstSerial
        else Word32
    x Word32 -> Word32 -> Word32
    forall a. Num a => a -> a -> a
    + Word32
    1)

    skipSepBy1 :: Parsec.Parser a -> Parsec.Parser b -> Parsec.Parser ()
    skipSepBy1 :: forall a b. Parser a -> Parser b -> Parser ()
    skipSepBy1 Parser a
    p Parser b
    sep = do
        _ <- Parser a
    p
        Parsec.skipMany (sep >> p)

    forceParse :: String -> (String -> Maybe a) -> String -> a
    forceParse :: forall a. String -> (String -> Maybe a) -> String -> a
    forceParse String
    label String -> Maybe a
    parse String
    str = case String -> Maybe a
    parse String
    str of
        Just a
    x -> a
    x
        Maybe a
    Nothing -> String -> a
    forall a. HasCallStack => String -> a
    error (String
    "Invalid " String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ String
    label String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ String
    ": " String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ ShowS
    forall a. Show a => a -> String
    show String
    str)

    maybeParseString :: MonadThrow m => Parsec.Parser a -> String -> m a
    maybeParseString :: forall (m :: * -> *) a. MonadThrow m => Parser a -> String -> m a
    maybeParseString Parser a
    parser String
    s = case Parser a -> String -> String -> Either ParseError a
    forall s t a.
    Stream s Identity t =>
    Parsec s () a -> String -> s -> Either ParseError a
    Parsec.parse Parser a
    parser String
    "" String
    s of
        Left ParseError
    err -> IOError -> m a
    forall e a. (HasCallStack, Exception e) => e -> m a
    forall (m :: * -> *) e a.
    (MonadThrow m, HasCallStack, Exception e) =>
    e -> m a
    throwM (IOError -> m a) -> IOError -> m a
    forall a b. (a -> b) -> a -> b
    $ String -> IOError
    userError (String -> IOError) -> String -> IOError
    forall a b. (a -> b) -> a -> b
    $ ParseError -> String
    forall a. Show a => a -> String
    show ParseError
    err
        Right a
    a -> a -> m a
    forall a. a -> m a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure a
    a

    THL.deriveLiftMany [''BusName, ''ObjectPath, ''InterfaceName, ''MemberName]