{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -Wno-unused-imports #-}
{-# OPTIONS_GHC -Wno-dodgy-exports #-}
{-# OPTIONS_GHC -Wno-unused-matches #-}
{-# OPTIONS_GHC -Wno-orphans #-}
{-# OPTIONS_GHC -Wno-unticked-promoted-constructors #-}
{-# OPTIONS_GHC -Wno-name-shadowing #-}
module Capnp.Gen.Capnp.Compat.Json where
import qualified Capnp.Message as Message
import qualified Capnp.Untyped as Untyped
import qualified Capnp.Basics as Basics
import qualified Capnp.GenHelpers as GenHelpers
import qualified Capnp.Classes as Classes
import qualified GHC.Generics as Generics
import qualified Capnp.Bits as Std_
import qualified Data.Maybe as Std_
import qualified Capnp.GenHelpers.ReExports.Data.ByteString as BS
import qualified Prelude as Std_
import qualified Data.Word as Std_
import qualified Data.Int as Std_
import Prelude ((<$>), (<*>), (>>=))
newtype Value msg
    = Value'newtype_ (Untyped.Struct msg)
instance (Classes.FromStruct msg (Value msg)) where
    fromStruct :: Struct msg -> m (Value msg)
fromStruct Struct msg
struct = (Value msg -> m (Value msg)
forall (f :: * -> *) a. Applicative f => a -> f a
Std_.pure (Struct msg -> Value msg
forall (msg :: Mutability). Struct msg -> Value msg
Value'newtype_ Struct msg
struct))
instance (Classes.ToStruct msg (Value msg)) where
    toStruct :: Value msg -> Struct msg
toStruct (Value'newtype_ Struct msg
struct) = Struct msg
struct
instance (Untyped.HasMessage (Value mut) mut) where
    message :: Value mut -> Message mut
message (Value'newtype_ Struct mut
struct) = (Struct mut -> Message mut
forall a (mut :: Mutability). HasMessage a mut => a -> Message mut
Untyped.message Struct mut
struct)
instance (Untyped.MessageDefault (Value mut) mut) where
    messageDefault :: Message mut -> m (Value mut)
messageDefault Message mut
msg = (Struct mut -> Value mut
forall (msg :: Mutability). Struct msg -> Value msg
Value'newtype_ (Struct mut -> Value mut) -> m (Struct mut) -> m (Value mut)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Message mut -> m (Struct mut)
forall a (mut :: Mutability) (m :: * -> *).
(MessageDefault a mut, ReadCtx m mut) =>
Message mut -> m a
Untyped.messageDefault Message mut
msg))
instance (Classes.FromPtr msg (Value msg)) where
    fromPtr :: Message msg -> Maybe (Ptr msg) -> m (Value msg)
fromPtr Message msg
msg Maybe (Ptr msg)
ptr = (Struct msg -> Value msg
forall (msg :: Mutability). Struct msg -> Value msg
Value'newtype_ (Struct msg -> Value msg) -> m (Struct msg) -> m (Value msg)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Message msg -> Maybe (Ptr msg) -> m (Struct msg)
forall (mut :: Mutability) a (m :: * -> *).
(FromPtr mut a, ReadCtx m mut) =>
Message mut -> Maybe (Ptr mut) -> m a
Classes.fromPtr Message msg
msg Maybe (Ptr msg)
ptr))
instance (Classes.ToPtr s (Value (Message.Mut s))) where
    toPtr :: Message ('Mut s) -> Value ('Mut s) -> m (Maybe (Ptr ('Mut s)))
toPtr Message ('Mut s)
msg (Value'newtype_ Struct ('Mut s)
struct) = (Message ('Mut s) -> Struct ('Mut s) -> m (Maybe (Ptr ('Mut s)))
forall s a (m :: * -> *).
(ToPtr s a, WriteCtx m s) =>
Message ('Mut s) -> a -> m (Maybe (Ptr ('Mut s)))
Classes.toPtr Message ('Mut s)
msg Struct ('Mut s)
struct)
instance (Classes.Allocate s (Value (Message.Mut s))) where
    new :: Message ('Mut s) -> m (Value ('Mut s))
new Message ('Mut s)
msg = (Struct ('Mut s) -> Value ('Mut s)
forall (msg :: Mutability). Struct msg -> Value msg
Value'newtype_ (Struct ('Mut s) -> Value ('Mut s))
-> m (Struct ('Mut s)) -> m (Value ('Mut s))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Message ('Mut s) -> Word16 -> Word16 -> m (Struct ('Mut s))
forall (m :: * -> *) s.
WriteCtx m s =>
Message ('Mut s) -> Word16 -> Word16 -> m (Struct ('Mut s))
Untyped.allocStruct Message ('Mut s)
msg Word16
2 Word16
1))
instance (Basics.ListElem mut (Value mut)) where
    newtype List mut (Value mut)
        = Value'List_ (Untyped.ListOf mut (Untyped.Struct mut))
    listFromPtr :: Message mut -> Maybe (Ptr mut) -> m (List mut (Value mut))
listFromPtr Message mut
msg Maybe (Ptr mut)
ptr = (ListOf mut (Struct mut) -> List mut (Value mut)
forall (mut :: Mutability).
ListOf mut (Struct mut) -> List mut (Value mut)
Value'List_ (ListOf mut (Struct mut) -> List mut (Value mut))
-> m (ListOf mut (Struct mut)) -> m (List mut (Value mut))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Message mut -> Maybe (Ptr mut) -> m (ListOf mut (Struct mut))
forall (mut :: Mutability) a (m :: * -> *).
(FromPtr mut a, ReadCtx m mut) =>
Message mut -> Maybe (Ptr mut) -> m a
Classes.fromPtr Message mut
msg Maybe (Ptr mut)
ptr))
    toUntypedList :: List mut (Value mut) -> List mut
toUntypedList (Value'List_ l) = (ListOf mut (Struct mut) -> List mut
forall (mut :: Mutability). ListOf mut (Struct mut) -> List mut
Untyped.ListStruct ListOf mut (Struct mut)
l)
    length :: List mut (Value mut) -> Int
length (Value'List_ l) = (ListOf mut (Struct mut) -> Int
forall (msg :: Mutability) a. ListOf msg a -> Int
Untyped.length ListOf mut (Struct mut)
l)
    index :: Int -> List mut (Value mut) -> m (Value mut)
index Int
i (Value'List_ l) = (do
        Struct mut
elt <- (Int -> ListOf mut (Struct mut) -> m (Struct mut)
forall (m :: * -> *) (mut :: Mutability) a.
ReadCtx m mut =>
Int -> ListOf mut a -> m a
Untyped.index Int
i ListOf mut (Struct mut)
l)
        (Struct mut -> m (Value mut)
forall (mut :: Mutability) a (m :: * -> *).
(FromStruct mut a, ReadCtx m mut) =>
Struct mut -> m a
Classes.fromStruct Struct mut
elt)
        )
instance (Basics.MutListElem s (Value (Message.Mut s))) where
    setIndex :: Value ('Mut s) -> Int -> List ('Mut s) (Value ('Mut s)) -> m ()
setIndex (Value'newtype_ Struct ('Mut s)
elt) Int
i (Value'List_ l) = (Struct ('Mut s) -> Int -> ListOf ('Mut s) (Struct ('Mut s)) -> m ()
forall (m :: * -> *) s a.
RWCtx m s =>
a -> Int -> ListOf ('Mut s) a -> m ()
Untyped.setIndex Struct ('Mut s)
elt Int
i ListOf ('Mut s) (Struct ('Mut s))
l)
    newList :: Message ('Mut s) -> Int -> m (List ('Mut s) (Value ('Mut s)))
newList Message ('Mut s)
msg Int
len = (ListOf ('Mut s) (Struct ('Mut s)) -> List ('Mut s) (Value ('Mut s))
forall (mut :: Mutability).
ListOf mut (Struct mut) -> List mut (Value mut)
Value'List_ (ListOf ('Mut s) (Struct ('Mut s))
 -> List ('Mut s) (Value ('Mut s)))
-> m (ListOf ('Mut s) (Struct ('Mut s)))
-> m (List ('Mut s) (Value ('Mut s)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Message ('Mut s)
-> Word16 -> Word16 -> Int -> m (ListOf ('Mut s) (Struct ('Mut s)))
forall (m :: * -> *) s.
WriteCtx m s =>
Message ('Mut s)
-> Word16 -> Word16 -> Int -> m (ListOf ('Mut s) (Struct ('Mut s)))
Untyped.allocCompositeList Message ('Mut s)
msg Word16
2 Word16
1 Int
len))
data Value' (mut :: Message.Mutability)
    = Value'null 
    | Value'boolean Std_.Bool
    | Value'number Std_.Double
    | Value'string (Basics.Text mut)
    | Value'array (Basics.List mut (Value mut))
    | Value'object (Basics.List mut (Value'Field mut))
    | Value'call (Value'Call mut)
    | Value'unknown' Std_.Word16
instance (Classes.FromStruct mut (Value' mut)) where
    fromStruct :: Struct mut -> m (Value' mut)
fromStruct Struct mut
struct = (do
        Word16
tag <- (Struct mut -> Int -> m Word16
forall (m :: * -> *) (mut :: Mutability).
ReadCtx m mut =>
Struct mut -> Int -> m Word16
GenHelpers.getTag Struct mut
struct Int
0)
        case Word16
tag of
            Word16
0 ->
                (Value' mut -> m (Value' mut)
forall (f :: * -> *) a. Applicative f => a -> f a
Std_.pure Value' mut
forall (mut :: Mutability). Value' mut
Value'null)
            Word16
1 ->
                (Bool -> Value' mut
forall (mut :: Mutability). Bool -> Value' mut
Value'boolean (Bool -> Value' mut) -> m Bool -> m (Value' mut)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Struct mut -> Int -> Int -> Word64 -> m Bool
forall (m :: * -> *) (mut :: Mutability) a.
(ReadCtx m mut, IsWord a) =>
Struct mut -> Int -> Int -> Word64 -> m a
GenHelpers.getWordField Struct mut
struct Int
0 Int
16 Word64
0))
            Word16
2 ->
                (Double -> Value' mut
forall (mut :: Mutability). Double -> Value' mut
Value'number (Double -> Value' mut) -> m Double -> m (Value' mut)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Struct mut -> Int -> Int -> Word64 -> m Double
forall (m :: * -> *) (mut :: Mutability) a.
(ReadCtx m mut, IsWord a) =>
Struct mut -> Int -> Int -> Word64 -> m a
GenHelpers.getWordField Struct mut
struct Int
1 Int
0 Word64
0))
            Word16
3 ->
                (Text mut -> Value' mut
forall (mut :: Mutability). Text mut -> Value' mut
Value'string (Text mut -> Value' mut) -> m (Text mut) -> m (Value' mut)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (do
                    Maybe (Ptr mut)
ptr <- (Int -> Struct mut -> m (Maybe (Ptr mut))
forall (m :: * -> *) (msg :: Mutability).
ReadCtx m msg =>
Int -> Struct msg -> m (Maybe (Ptr msg))
Untyped.getPtr Int
0 Struct mut
struct)
                    (Message mut -> Maybe (Ptr mut) -> m (Text mut)
forall (mut :: Mutability) a (m :: * -> *).
(FromPtr mut a, ReadCtx m mut) =>
Message mut -> Maybe (Ptr mut) -> m a
Classes.fromPtr (Struct mut -> Message mut
forall a (mut :: Mutability). HasMessage a mut => a -> Message mut
Untyped.message Struct mut
struct) Maybe (Ptr mut)
ptr)
                    ))
            Word16
4 ->
                (List mut (Value mut) -> Value' mut
forall (mut :: Mutability). List mut (Value mut) -> Value' mut
Value'array (List mut (Value mut) -> Value' mut)
-> m (List mut (Value mut)) -> m (Value' mut)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (do
                    Maybe (Ptr mut)
ptr <- (Int -> Struct mut -> m (Maybe (Ptr mut))
forall (m :: * -> *) (msg :: Mutability).
ReadCtx m msg =>
Int -> Struct msg -> m (Maybe (Ptr msg))
Untyped.getPtr Int
0 Struct mut
struct)
                    (Message mut -> Maybe (Ptr mut) -> m (List mut (Value mut))
forall (mut :: Mutability) a (m :: * -> *).
(FromPtr mut a, ReadCtx m mut) =>
Message mut -> Maybe (Ptr mut) -> m a
Classes.fromPtr (Struct mut -> Message mut
forall a (mut :: Mutability). HasMessage a mut => a -> Message mut
Untyped.message Struct mut
struct) Maybe (Ptr mut)
ptr)
                    ))
            Word16
5 ->
                (List mut (Value'Field mut) -> Value' mut
forall (mut :: Mutability).
List mut (Value'Field mut) -> Value' mut
Value'object (List mut (Value'Field mut) -> Value' mut)
-> m (List mut (Value'Field mut)) -> m (Value' mut)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (do
                    Maybe (Ptr mut)
ptr <- (Int -> Struct mut -> m (Maybe (Ptr mut))
forall (m :: * -> *) (msg :: Mutability).
ReadCtx m msg =>
Int -> Struct msg -> m (Maybe (Ptr msg))
Untyped.getPtr Int
0 Struct mut
struct)
                    (Message mut -> Maybe (Ptr mut) -> m (List mut (Value'Field mut))
forall (mut :: Mutability) a (m :: * -> *).
(FromPtr mut a, ReadCtx m mut) =>
Message mut -> Maybe (Ptr mut) -> m a
Classes.fromPtr (Struct mut -> Message mut
forall a (mut :: Mutability). HasMessage a mut => a -> Message mut
Untyped.message Struct mut
struct) Maybe (Ptr mut)
ptr)
                    ))
            Word16
6 ->
                (Value'Call mut -> Value' mut
forall (mut :: Mutability). Value'Call mut -> Value' mut
Value'call (Value'Call mut -> Value' mut)
-> m (Value'Call mut) -> m (Value' mut)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (do
                    Maybe (Ptr mut)
ptr <- (Int -> Struct mut -> m (Maybe (Ptr mut))
forall (m :: * -> *) (msg :: Mutability).
ReadCtx m msg =>
Int -> Struct msg -> m (Maybe (Ptr msg))
Untyped.getPtr Int
0 Struct mut
struct)
                    (Message mut -> Maybe (Ptr mut) -> m (Value'Call mut)
forall (mut :: Mutability) a (m :: * -> *).
(FromPtr mut a, ReadCtx m mut) =>
Message mut -> Maybe (Ptr mut) -> m a
Classes.fromPtr (Struct mut -> Message mut
forall a (mut :: Mutability). HasMessage a mut => a -> Message mut
Untyped.message Struct mut
struct) Maybe (Ptr mut)
ptr)
                    ))
            Word16
_ ->
                (Value' mut -> m (Value' mut)
forall (f :: * -> *) a. Applicative f => a -> f a
Std_.pure (Word16 -> Value' mut
forall (mut :: Mutability). Word16 -> Value' mut
Value'unknown' (Word16 -> Word16
forall a b. (Integral a, Num b) => a -> b
Std_.fromIntegral Word16
tag)))
        )
get_Value' :: ((Untyped.ReadCtx m msg)
              ,(Classes.FromStruct msg (Value' msg))) => (Value msg) -> (m (Value' msg))
get_Value' :: Value msg -> m (Value' msg)
get_Value' (Value'newtype_ Struct msg
struct) = (Struct msg -> m (Value' msg)
forall (mut :: Mutability) a (m :: * -> *).
(FromStruct mut a, ReadCtx m mut) =>
Struct mut -> m a
Classes.fromStruct Struct msg
struct)
set_Value'null :: ((Untyped.RWCtx m s)) => (Value (Message.Mut s)) -> (m ())
set_Value'null :: Value ('Mut s) -> m ()
set_Value'null (Value'newtype_ Struct ('Mut s)
struct) = (do
    (Struct ('Mut s) -> Word16 -> Int -> Int -> Word64 -> m ()
forall (m :: * -> *) s a.
(RWCtx m s, Bounded a, Integral a, IsWord a, Bits a) =>
Struct ('Mut s) -> a -> Int -> Int -> Word64 -> m ()
GenHelpers.setWordField Struct ('Mut s)
struct (Word16
0 :: Std_.Word16) Int
0 Int
0 Word64
0)
    (() -> m ()
forall (f :: * -> *) a. Applicative f => a -> f a
Std_.pure ())
    )
set_Value'boolean :: ((Untyped.RWCtx m s)) => (Value (Message.Mut s)) -> Std_.Bool -> (m ())
set_Value'boolean :: Value ('Mut s) -> Bool -> m ()
set_Value'boolean (Value'newtype_ Struct ('Mut s)
struct) Bool
value = (do
    (Struct ('Mut s) -> Word16 -> Int -> Int -> Word64 -> m ()
forall (m :: * -> *) s a.
(RWCtx m s, Bounded a, Integral a, IsWord a, Bits a) =>
Struct ('Mut s) -> a -> Int -> Int -> Word64 -> m ()
GenHelpers.setWordField Struct ('Mut s)
struct (Word16
1 :: Std_.Word16) Int
0 Int
0 Word64
0)
    (Struct ('Mut s) -> Word1 -> Int -> Int -> Word64 -> m ()
forall (m :: * -> *) s a.
(RWCtx m s, Bounded a, Integral a, IsWord a, Bits a) =>
Struct ('Mut s) -> a -> Int -> Int -> Word64 -> m ()
GenHelpers.setWordField Struct ('Mut s)
struct ((Word64 -> Word1
forall a b. (Integral a, Num b) => a -> b
Std_.fromIntegral (Bool -> Word64
forall a. IsWord a => a -> Word64
Classes.toWord Bool
value)) :: Std_.Word1) Int
0 Int
16 Word64
0)
    )
set_Value'number :: ((Untyped.RWCtx m s)) => (Value (Message.Mut s)) -> Std_.Double -> (m ())
set_Value'number :: Value ('Mut s) -> Double -> m ()
set_Value'number (Value'newtype_ Struct ('Mut s)
struct) Double
value = (do
    (Struct ('Mut s) -> Word16 -> Int -> Int -> Word64 -> m ()
forall (m :: * -> *) s a.
(RWCtx m s, Bounded a, Integral a, IsWord a, Bits a) =>
Struct ('Mut s) -> a -> Int -> Int -> Word64 -> m ()
GenHelpers.setWordField Struct ('Mut s)
struct (Word16
2 :: Std_.Word16) Int
0 Int
0 Word64
0)
    (Struct ('Mut s) -> Word64 -> Int -> Int -> Word64 -> m ()
forall (m :: * -> *) s a.
(RWCtx m s, Bounded a, Integral a, IsWord a, Bits a) =>
Struct ('Mut s) -> a -> Int -> Int -> Word64 -> m ()
GenHelpers.setWordField Struct ('Mut s)
struct ((Word64 -> Word64
forall a b. (Integral a, Num b) => a -> b
Std_.fromIntegral (Double -> Word64
forall a. IsWord a => a -> Word64
Classes.toWord Double
value)) :: Std_.Word64) Int
1 Int
0 Word64
0)
    )
set_Value'string :: ((Untyped.RWCtx m s)
                    ,(Classes.ToPtr s (Basics.Text (Message.Mut s)))) => (Value (Message.Mut s)) -> (Basics.Text (Message.Mut s)) -> (m ())
set_Value'string :: Value ('Mut s) -> Text ('Mut s) -> m ()
set_Value'string (Value'newtype_ Struct ('Mut s)
struct) Text ('Mut s)
value = (do
    (Struct ('Mut s) -> Word16 -> Int -> Int -> Word64 -> m ()
forall (m :: * -> *) s a.
(RWCtx m s, Bounded a, Integral a, IsWord a, Bits a) =>
Struct ('Mut s) -> a -> Int -> Int -> Word64 -> m ()
GenHelpers.setWordField Struct ('Mut s)
struct (Word16
3 :: Std_.Word16) Int
0 Int
0 Word64
0)
    (do
        Maybe (Ptr ('Mut s))
ptr <- (Message ('Mut s) -> Text ('Mut s) -> m (Maybe (Ptr ('Mut s)))
forall s a (m :: * -> *).
(ToPtr s a, WriteCtx m s) =>
Message ('Mut s) -> a -> m (Maybe (Ptr ('Mut s)))
Classes.toPtr (Struct ('Mut s) -> Message ('Mut s)
forall a (mut :: Mutability). HasMessage a mut => a -> Message mut
Untyped.message Struct ('Mut s)
struct) Text ('Mut s)
value)
        (Maybe (Ptr ('Mut s)) -> Int -> Struct ('Mut s) -> m ()
forall (m :: * -> *) s.
(ReadCtx m ('Mut s), WriteCtx m s) =>
Maybe (Ptr ('Mut s)) -> Int -> Struct ('Mut s) -> m ()
Untyped.setPtr Maybe (Ptr ('Mut s))
ptr Int
0 Struct ('Mut s)
struct)
        )
    )
set_Value'array :: ((Untyped.RWCtx m s)
                   ,(Classes.ToPtr s (Basics.List (Message.Mut s) (Value (Message.Mut s))))) => (Value (Message.Mut s)) -> (Basics.List (Message.Mut s) (Value (Message.Mut s))) -> (m ())
set_Value'array :: Value ('Mut s) -> List ('Mut s) (Value ('Mut s)) -> m ()
set_Value'array (Value'newtype_ Struct ('Mut s)
struct) List ('Mut s) (Value ('Mut s))
value = (do
    (Struct ('Mut s) -> Word16 -> Int -> Int -> Word64 -> m ()
forall (m :: * -> *) s a.
(RWCtx m s, Bounded a, Integral a, IsWord a, Bits a) =>
Struct ('Mut s) -> a -> Int -> Int -> Word64 -> m ()
GenHelpers.setWordField Struct ('Mut s)
struct (Word16
4 :: Std_.Word16) Int
0 Int
0 Word64
0)
    (do
        Maybe (Ptr ('Mut s))
ptr <- (Message ('Mut s)
-> List ('Mut s) (Value ('Mut s)) -> m (Maybe (Ptr ('Mut s)))
forall s a (m :: * -> *).
(ToPtr s a, WriteCtx m s) =>
Message ('Mut s) -> a -> m (Maybe (Ptr ('Mut s)))
Classes.toPtr (Struct ('Mut s) -> Message ('Mut s)
forall a (mut :: Mutability). HasMessage a mut => a -> Message mut
Untyped.message Struct ('Mut s)
struct) List ('Mut s) (Value ('Mut s))
value)
        (Maybe (Ptr ('Mut s)) -> Int -> Struct ('Mut s) -> m ()
forall (m :: * -> *) s.
(ReadCtx m ('Mut s), WriteCtx m s) =>
Maybe (Ptr ('Mut s)) -> Int -> Struct ('Mut s) -> m ()
Untyped.setPtr Maybe (Ptr ('Mut s))
ptr Int
0 Struct ('Mut s)
struct)
        )
    )
set_Value'object :: ((Untyped.RWCtx m s)
                    ,(Classes.ToPtr s (Basics.List (Message.Mut s) (Value'Field (Message.Mut s))))) => (Value (Message.Mut s)) -> (Basics.List (Message.Mut s) (Value'Field (Message.Mut s))) -> (m ())
set_Value'object :: Value ('Mut s) -> List ('Mut s) (Value'Field ('Mut s)) -> m ()
set_Value'object (Value'newtype_ Struct ('Mut s)
struct) List ('Mut s) (Value'Field ('Mut s))
value = (do
    (Struct ('Mut s) -> Word16 -> Int -> Int -> Word64 -> m ()
forall (m :: * -> *) s a.
(RWCtx m s, Bounded a, Integral a, IsWord a, Bits a) =>
Struct ('Mut s) -> a -> Int -> Int -> Word64 -> m ()
GenHelpers.setWordField Struct ('Mut s)
struct (Word16
5 :: Std_.Word16) Int
0 Int
0 Word64
0)
    (do
        Maybe (Ptr ('Mut s))
ptr <- (Message ('Mut s)
-> List ('Mut s) (Value'Field ('Mut s)) -> m (Maybe (Ptr ('Mut s)))
forall s a (m :: * -> *).
(ToPtr s a, WriteCtx m s) =>
Message ('Mut s) -> a -> m (Maybe (Ptr ('Mut s)))
Classes.toPtr (Struct ('Mut s) -> Message ('Mut s)
forall a (mut :: Mutability). HasMessage a mut => a -> Message mut
Untyped.message Struct ('Mut s)
struct) List ('Mut s) (Value'Field ('Mut s))
value)
        (Maybe (Ptr ('Mut s)) -> Int -> Struct ('Mut s) -> m ()
forall (m :: * -> *) s.
(ReadCtx m ('Mut s), WriteCtx m s) =>
Maybe (Ptr ('Mut s)) -> Int -> Struct ('Mut s) -> m ()
Untyped.setPtr Maybe (Ptr ('Mut s))
ptr Int
0 Struct ('Mut s)
struct)
        )
    )
set_Value'call :: ((Untyped.RWCtx m s)
                  ,(Classes.ToPtr s (Value'Call (Message.Mut s)))) => (Value (Message.Mut s)) -> (Value'Call (Message.Mut s)) -> (m ())
set_Value'call :: Value ('Mut s) -> Value'Call ('Mut s) -> m ()
set_Value'call (Value'newtype_ Struct ('Mut s)
struct) Value'Call ('Mut s)
value = (do
    (Struct ('Mut s) -> Word16 -> Int -> Int -> Word64 -> m ()
forall (m :: * -> *) s a.
(RWCtx m s, Bounded a, Integral a, IsWord a, Bits a) =>
Struct ('Mut s) -> a -> Int -> Int -> Word64 -> m ()
GenHelpers.setWordField Struct ('Mut s)
struct (Word16
6 :: Std_.Word16) Int
0 Int
0 Word64
0)
    (do
        Maybe (Ptr ('Mut s))
ptr <- (Message ('Mut s) -> Value'Call ('Mut s) -> m (Maybe (Ptr ('Mut s)))
forall s a (m :: * -> *).
(ToPtr s a, WriteCtx m s) =>
Message ('Mut s) -> a -> m (Maybe (Ptr ('Mut s)))
Classes.toPtr (Struct ('Mut s) -> Message ('Mut s)
forall a (mut :: Mutability). HasMessage a mut => a -> Message mut
Untyped.message Struct ('Mut s)
struct) Value'Call ('Mut s)
value)
        (Maybe (Ptr ('Mut s)) -> Int -> Struct ('Mut s) -> m ()
forall (m :: * -> *) s.
(ReadCtx m ('Mut s), WriteCtx m s) =>
Maybe (Ptr ('Mut s)) -> Int -> Struct ('Mut s) -> m ()
Untyped.setPtr Maybe (Ptr ('Mut s))
ptr Int
0 Struct ('Mut s)
struct)
        )
    )
set_Value'unknown' :: ((Untyped.RWCtx m s)) => (Value (Message.Mut s)) -> Std_.Word16 -> (m ())
set_Value'unknown' :: Value ('Mut s) -> Word16 -> m ()
set_Value'unknown' (Value'newtype_ Struct ('Mut s)
struct) Word16
value = (Struct ('Mut s) -> Word16 -> Int -> Int -> Word64 -> m ()
forall (m :: * -> *) s a.
(RWCtx m s, Bounded a, Integral a, IsWord a, Bits a) =>
Struct ('Mut s) -> a -> Int -> Int -> Word64 -> m ()
GenHelpers.setWordField Struct ('Mut s)
struct ((Word64 -> Word16
forall a b. (Integral a, Num b) => a -> b
Std_.fromIntegral (Word16 -> Word64
forall a. IsWord a => a -> Word64
Classes.toWord Word16
value)) :: Std_.Word16) Int
0 Int
0 Word64
0)
newtype Value'Field msg
    = Value'Field'newtype_ (Untyped.Struct msg)
instance (Classes.FromStruct msg (Value'Field msg)) where
    fromStruct :: Struct msg -> m (Value'Field msg)
fromStruct Struct msg
struct = (Value'Field msg -> m (Value'Field msg)
forall (f :: * -> *) a. Applicative f => a -> f a
Std_.pure (Struct msg -> Value'Field msg
forall (msg :: Mutability). Struct msg -> Value'Field msg
Value'Field'newtype_ Struct msg
struct))
instance (Classes.ToStruct msg (Value'Field msg)) where
    toStruct :: Value'Field msg -> Struct msg
toStruct (Value'Field'newtype_ Struct msg
struct) = Struct msg
struct
instance (Untyped.HasMessage (Value'Field mut) mut) where
    message :: Value'Field mut -> Message mut
message (Value'Field'newtype_ Struct mut
struct) = (Struct mut -> Message mut
forall a (mut :: Mutability). HasMessage a mut => a -> Message mut
Untyped.message Struct mut
struct)
instance (Untyped.MessageDefault (Value'Field mut) mut) where
    messageDefault :: Message mut -> m (Value'Field mut)
messageDefault Message mut
msg = (Struct mut -> Value'Field mut
forall (msg :: Mutability). Struct msg -> Value'Field msg
Value'Field'newtype_ (Struct mut -> Value'Field mut)
-> m (Struct mut) -> m (Value'Field mut)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Message mut -> m (Struct mut)
forall a (mut :: Mutability) (m :: * -> *).
(MessageDefault a mut, ReadCtx m mut) =>
Message mut -> m a
Untyped.messageDefault Message mut
msg))
instance (Classes.FromPtr msg (Value'Field msg)) where
    fromPtr :: Message msg -> Maybe (Ptr msg) -> m (Value'Field msg)
fromPtr Message msg
msg Maybe (Ptr msg)
ptr = (Struct msg -> Value'Field msg
forall (msg :: Mutability). Struct msg -> Value'Field msg
Value'Field'newtype_ (Struct msg -> Value'Field msg)
-> m (Struct msg) -> m (Value'Field msg)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Message msg -> Maybe (Ptr msg) -> m (Struct msg)
forall (mut :: Mutability) a (m :: * -> *).
(FromPtr mut a, ReadCtx m mut) =>
Message mut -> Maybe (Ptr mut) -> m a
Classes.fromPtr Message msg
msg Maybe (Ptr msg)
ptr))
instance (Classes.ToPtr s (Value'Field (Message.Mut s))) where
    toPtr :: Message ('Mut s)
-> Value'Field ('Mut s) -> m (Maybe (Ptr ('Mut s)))
toPtr Message ('Mut s)
msg (Value'Field'newtype_ Struct ('Mut s)
struct) = (Message ('Mut s) -> Struct ('Mut s) -> m (Maybe (Ptr ('Mut s)))
forall s a (m :: * -> *).
(ToPtr s a, WriteCtx m s) =>
Message ('Mut s) -> a -> m (Maybe (Ptr ('Mut s)))
Classes.toPtr Message ('Mut s)
msg Struct ('Mut s)
struct)
instance (Classes.Allocate s (Value'Field (Message.Mut s))) where
    new :: Message ('Mut s) -> m (Value'Field ('Mut s))
new Message ('Mut s)
msg = (Struct ('Mut s) -> Value'Field ('Mut s)
forall (msg :: Mutability). Struct msg -> Value'Field msg
Value'Field'newtype_ (Struct ('Mut s) -> Value'Field ('Mut s))
-> m (Struct ('Mut s)) -> m (Value'Field ('Mut s))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Message ('Mut s) -> Word16 -> Word16 -> m (Struct ('Mut s))
forall (m :: * -> *) s.
WriteCtx m s =>
Message ('Mut s) -> Word16 -> Word16 -> m (Struct ('Mut s))
Untyped.allocStruct Message ('Mut s)
msg Word16
0 Word16
2))
instance (Basics.ListElem mut (Value'Field mut)) where
    newtype List mut (Value'Field mut)
        = Value'Field'List_ (Untyped.ListOf mut (Untyped.Struct mut))
    listFromPtr :: Message mut -> Maybe (Ptr mut) -> m (List mut (Value'Field mut))
listFromPtr Message mut
msg Maybe (Ptr mut)
ptr = (ListOf mut (Struct mut) -> List mut (Value'Field mut)
forall (mut :: Mutability).
ListOf mut (Struct mut) -> List mut (Value'Field mut)
Value'Field'List_ (ListOf mut (Struct mut) -> List mut (Value'Field mut))
-> m (ListOf mut (Struct mut)) -> m (List mut (Value'Field mut))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Message mut -> Maybe (Ptr mut) -> m (ListOf mut (Struct mut))
forall (mut :: Mutability) a (m :: * -> *).
(FromPtr mut a, ReadCtx m mut) =>
Message mut -> Maybe (Ptr mut) -> m a
Classes.fromPtr Message mut
msg Maybe (Ptr mut)
ptr))
    toUntypedList :: List mut (Value'Field mut) -> List mut
toUntypedList (Value'Field'List_ l) = (ListOf mut (Struct mut) -> List mut
forall (mut :: Mutability). ListOf mut (Struct mut) -> List mut
Untyped.ListStruct ListOf mut (Struct mut)
l)
    length :: List mut (Value'Field mut) -> Int
length (Value'Field'List_ l) = (ListOf mut (Struct mut) -> Int
forall (msg :: Mutability) a. ListOf msg a -> Int
Untyped.length ListOf mut (Struct mut)
l)
    index :: Int -> List mut (Value'Field mut) -> m (Value'Field mut)
index Int
i (Value'Field'List_ l) = (do
        Struct mut
elt <- (Int -> ListOf mut (Struct mut) -> m (Struct mut)
forall (m :: * -> *) (mut :: Mutability) a.
ReadCtx m mut =>
Int -> ListOf mut a -> m a
Untyped.index Int
i ListOf mut (Struct mut)
l)
        (Struct mut -> m (Value'Field mut)
forall (mut :: Mutability) a (m :: * -> *).
(FromStruct mut a, ReadCtx m mut) =>
Struct mut -> m a
Classes.fromStruct Struct mut
elt)
        )
instance (Basics.MutListElem s (Value'Field (Message.Mut s))) where
    setIndex :: Value'Field ('Mut s)
-> Int -> List ('Mut s) (Value'Field ('Mut s)) -> m ()
setIndex (Value'Field'newtype_ Struct ('Mut s)
elt) Int
i (Value'Field'List_ l) = (Struct ('Mut s) -> Int -> ListOf ('Mut s) (Struct ('Mut s)) -> m ()
forall (m :: * -> *) s a.
RWCtx m s =>
a -> Int -> ListOf ('Mut s) a -> m ()
Untyped.setIndex Struct ('Mut s)
elt Int
i ListOf ('Mut s) (Struct ('Mut s))
l)
    newList :: Message ('Mut s) -> Int -> m (List ('Mut s) (Value'Field ('Mut s)))
newList Message ('Mut s)
msg Int
len = (ListOf ('Mut s) (Struct ('Mut s))
-> List ('Mut s) (Value'Field ('Mut s))
forall (mut :: Mutability).
ListOf mut (Struct mut) -> List mut (Value'Field mut)
Value'Field'List_ (ListOf ('Mut s) (Struct ('Mut s))
 -> List ('Mut s) (Value'Field ('Mut s)))
-> m (ListOf ('Mut s) (Struct ('Mut s)))
-> m (List ('Mut s) (Value'Field ('Mut s)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Message ('Mut s)
-> Word16 -> Word16 -> Int -> m (ListOf ('Mut s) (Struct ('Mut s)))
forall (m :: * -> *) s.
WriteCtx m s =>
Message ('Mut s)
-> Word16 -> Word16 -> Int -> m (ListOf ('Mut s) (Struct ('Mut s)))
Untyped.allocCompositeList Message ('Mut s)
msg Word16
0 Word16
2 Int
len))
get_Value'Field'name :: ((Untyped.ReadCtx m msg)
                        ,(Classes.FromPtr msg (Basics.Text msg))) => (Value'Field msg) -> (m (Basics.Text msg))
get_Value'Field'name :: Value'Field msg -> m (Text msg)
get_Value'Field'name (Value'Field'newtype_ Struct msg
struct) = (do
    Maybe (Ptr msg)
ptr <- (Int -> Struct msg -> m (Maybe (Ptr msg))
forall (m :: * -> *) (msg :: Mutability).
ReadCtx m msg =>
Int -> Struct msg -> m (Maybe (Ptr msg))
Untyped.getPtr Int
0 Struct msg
struct)
    (Message msg -> Maybe (Ptr msg) -> m (Text msg)
forall (mut :: Mutability) a (m :: * -> *).
(FromPtr mut a, ReadCtx m mut) =>
Message mut -> Maybe (Ptr mut) -> m a
Classes.fromPtr (Struct msg -> Message msg
forall a (mut :: Mutability). HasMessage a mut => a -> Message mut
Untyped.message Struct msg
struct) Maybe (Ptr msg)
ptr)
    )
set_Value'Field'name :: ((Untyped.RWCtx m s)
                        ,(Classes.ToPtr s (Basics.Text (Message.Mut s)))) => (Value'Field (Message.Mut s)) -> (Basics.Text (Message.Mut s)) -> (m ())
set_Value'Field'name :: Value'Field ('Mut s) -> Text ('Mut s) -> m ()
set_Value'Field'name (Value'Field'newtype_ Struct ('Mut s)
struct) Text ('Mut s)
value = (do
    Maybe (Ptr ('Mut s))
ptr <- (Message ('Mut s) -> Text ('Mut s) -> m (Maybe (Ptr ('Mut s)))
forall s a (m :: * -> *).
(ToPtr s a, WriteCtx m s) =>
Message ('Mut s) -> a -> m (Maybe (Ptr ('Mut s)))
Classes.toPtr (Struct ('Mut s) -> Message ('Mut s)
forall a (mut :: Mutability). HasMessage a mut => a -> Message mut
Untyped.message Struct ('Mut s)
struct) Text ('Mut s)
value)
    (Maybe (Ptr ('Mut s)) -> Int -> Struct ('Mut s) -> m ()
forall (m :: * -> *) s.
(ReadCtx m ('Mut s), WriteCtx m s) =>
Maybe (Ptr ('Mut s)) -> Int -> Struct ('Mut s) -> m ()
Untyped.setPtr Maybe (Ptr ('Mut s))
ptr Int
0 Struct ('Mut s)
struct)
    )
has_Value'Field'name :: ((Untyped.ReadCtx m msg)) => (Value'Field msg) -> (m Std_.Bool)
has_Value'Field'name :: Value'Field msg -> m Bool
has_Value'Field'name (Value'Field'newtype_ Struct msg
struct) = (Maybe (Ptr msg) -> Bool
forall a. Maybe a -> Bool
Std_.isJust (Maybe (Ptr msg) -> Bool) -> m (Maybe (Ptr msg)) -> m Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Int -> Struct msg -> m (Maybe (Ptr msg))
forall (m :: * -> *) (msg :: Mutability).
ReadCtx m msg =>
Int -> Struct msg -> m (Maybe (Ptr msg))
Untyped.getPtr Int
0 Struct msg
struct))
new_Value'Field'name :: ((Untyped.RWCtx m s)) => Std_.Int -> (Value'Field (Message.Mut s)) -> (m (Basics.Text (Message.Mut s)))
new_Value'Field'name :: Int -> Value'Field ('Mut s) -> m (Text ('Mut s))
new_Value'Field'name Int
len Value'Field ('Mut s)
struct = (do
    Text ('Mut s)
result <- (Message ('Mut s) -> Int -> m (Text ('Mut s))
forall (m :: * -> *) s.
WriteCtx m s =>
Message ('Mut s) -> Int -> m (Text ('Mut s))
Basics.newText (Value'Field ('Mut s) -> Message ('Mut s)
forall a (mut :: Mutability). HasMessage a mut => a -> Message mut
Untyped.message Value'Field ('Mut s)
struct) Int
len)
    (Value'Field ('Mut s) -> Text ('Mut s) -> m ()
forall (m :: * -> *) s.
(RWCtx m s, ToPtr s (Text ('Mut s))) =>
Value'Field ('Mut s) -> Text ('Mut s) -> m ()
set_Value'Field'name Value'Field ('Mut s)
struct Text ('Mut s)
result)
    (Text ('Mut s) -> m (Text ('Mut s))
forall (f :: * -> *) a. Applicative f => a -> f a
Std_.pure Text ('Mut s)
result)
    )
get_Value'Field'value :: ((Untyped.ReadCtx m msg)
                         ,(Classes.FromPtr msg (Value msg))) => (Value'Field msg) -> (m (Value msg))
get_Value'Field'value :: Value'Field msg -> m (Value msg)
get_Value'Field'value (Value'Field'newtype_ Struct msg
struct) = (do
    Maybe (Ptr msg)
ptr <- (Int -> Struct msg -> m (Maybe (Ptr msg))
forall (m :: * -> *) (msg :: Mutability).
ReadCtx m msg =>
Int -> Struct msg -> m (Maybe (Ptr msg))
Untyped.getPtr Int
1 Struct msg
struct)
    (Message msg -> Maybe (Ptr msg) -> m (Value msg)
forall (mut :: Mutability) a (m :: * -> *).
(FromPtr mut a, ReadCtx m mut) =>
Message mut -> Maybe (Ptr mut) -> m a
Classes.fromPtr (Struct msg -> Message msg
forall a (mut :: Mutability). HasMessage a mut => a -> Message mut
Untyped.message Struct msg
struct) Maybe (Ptr msg)
ptr)
    )
set_Value'Field'value :: ((Untyped.RWCtx m s)
                         ,(Classes.ToPtr s (Value (Message.Mut s)))) => (Value'Field (Message.Mut s)) -> (Value (Message.Mut s)) -> (m ())
set_Value'Field'value :: Value'Field ('Mut s) -> Value ('Mut s) -> m ()
set_Value'Field'value (Value'Field'newtype_ Struct ('Mut s)
struct) Value ('Mut s)
value = (do
    Maybe (Ptr ('Mut s))
ptr <- (Message ('Mut s) -> Value ('Mut s) -> m (Maybe (Ptr ('Mut s)))
forall s a (m :: * -> *).
(ToPtr s a, WriteCtx m s) =>
Message ('Mut s) -> a -> m (Maybe (Ptr ('Mut s)))
Classes.toPtr (Struct ('Mut s) -> Message ('Mut s)
forall a (mut :: Mutability). HasMessage a mut => a -> Message mut
Untyped.message Struct ('Mut s)
struct) Value ('Mut s)
value)
    (Maybe (Ptr ('Mut s)) -> Int -> Struct ('Mut s) -> m ()
forall (m :: * -> *) s.
(ReadCtx m ('Mut s), WriteCtx m s) =>
Maybe (Ptr ('Mut s)) -> Int -> Struct ('Mut s) -> m ()
Untyped.setPtr Maybe (Ptr ('Mut s))
ptr Int
1 Struct ('Mut s)
struct)
    )
has_Value'Field'value :: ((Untyped.ReadCtx m msg)) => (Value'Field msg) -> (m Std_.Bool)
has_Value'Field'value :: Value'Field msg -> m Bool
has_Value'Field'value (Value'Field'newtype_ Struct msg
struct) = (Maybe (Ptr msg) -> Bool
forall a. Maybe a -> Bool
Std_.isJust (Maybe (Ptr msg) -> Bool) -> m (Maybe (Ptr msg)) -> m Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Int -> Struct msg -> m (Maybe (Ptr msg))
forall (m :: * -> *) (msg :: Mutability).
ReadCtx m msg =>
Int -> Struct msg -> m (Maybe (Ptr msg))
Untyped.getPtr Int
1 Struct msg
struct))
new_Value'Field'value :: ((Untyped.RWCtx m s)) => (Value'Field (Message.Mut s)) -> (m (Value (Message.Mut s)))
new_Value'Field'value :: Value'Field ('Mut s) -> m (Value ('Mut s))
new_Value'Field'value Value'Field ('Mut s)
struct = (do
    Value ('Mut s)
result <- (Message ('Mut s) -> m (Value ('Mut s))
forall s e (m :: * -> *).
(Allocate s e, WriteCtx m s) =>
Message ('Mut s) -> m e
Classes.new (Value'Field ('Mut s) -> Message ('Mut s)
forall a (mut :: Mutability). HasMessage a mut => a -> Message mut
Untyped.message Value'Field ('Mut s)
struct))
    (Value'Field ('Mut s) -> Value ('Mut s) -> m ()
forall (m :: * -> *) s.
(RWCtx m s, ToPtr s (Value ('Mut s))) =>
Value'Field ('Mut s) -> Value ('Mut s) -> m ()
set_Value'Field'value Value'Field ('Mut s)
struct Value ('Mut s)
result)
    (Value ('Mut s) -> m (Value ('Mut s))
forall (f :: * -> *) a. Applicative f => a -> f a
Std_.pure Value ('Mut s)
result)
    )
newtype Value'Call msg
    = Value'Call'newtype_ (Untyped.Struct msg)
instance (Classes.FromStruct msg (Value'Call msg)) where
    fromStruct :: Struct msg -> m (Value'Call msg)
fromStruct Struct msg
struct = (Value'Call msg -> m (Value'Call msg)
forall (f :: * -> *) a. Applicative f => a -> f a
Std_.pure (Struct msg -> Value'Call msg
forall (msg :: Mutability). Struct msg -> Value'Call msg
Value'Call'newtype_ Struct msg
struct))
instance (Classes.ToStruct msg (Value'Call msg)) where
    toStruct :: Value'Call msg -> Struct msg
toStruct (Value'Call'newtype_ Struct msg
struct) = Struct msg
struct
instance (Untyped.HasMessage (Value'Call mut) mut) where
    message :: Value'Call mut -> Message mut
message (Value'Call'newtype_ Struct mut
struct) = (Struct mut -> Message mut
forall a (mut :: Mutability). HasMessage a mut => a -> Message mut
Untyped.message Struct mut
struct)
instance (Untyped.MessageDefault (Value'Call mut) mut) where
    messageDefault :: Message mut -> m (Value'Call mut)
messageDefault Message mut
msg = (Struct mut -> Value'Call mut
forall (msg :: Mutability). Struct msg -> Value'Call msg
Value'Call'newtype_ (Struct mut -> Value'Call mut)
-> m (Struct mut) -> m (Value'Call mut)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Message mut -> m (Struct mut)
forall a (mut :: Mutability) (m :: * -> *).
(MessageDefault a mut, ReadCtx m mut) =>
Message mut -> m a
Untyped.messageDefault Message mut
msg))
instance (Classes.FromPtr msg (Value'Call msg)) where
    fromPtr :: Message msg -> Maybe (Ptr msg) -> m (Value'Call msg)
fromPtr Message msg
msg Maybe (Ptr msg)
ptr = (Struct msg -> Value'Call msg
forall (msg :: Mutability). Struct msg -> Value'Call msg
Value'Call'newtype_ (Struct msg -> Value'Call msg)
-> m (Struct msg) -> m (Value'Call msg)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Message msg -> Maybe (Ptr msg) -> m (Struct msg)
forall (mut :: Mutability) a (m :: * -> *).
(FromPtr mut a, ReadCtx m mut) =>
Message mut -> Maybe (Ptr mut) -> m a
Classes.fromPtr Message msg
msg Maybe (Ptr msg)
ptr))
instance (Classes.ToPtr s (Value'Call (Message.Mut s))) where
    toPtr :: Message ('Mut s) -> Value'Call ('Mut s) -> m (Maybe (Ptr ('Mut s)))
toPtr Message ('Mut s)
msg (Value'Call'newtype_ Struct ('Mut s)
struct) = (Message ('Mut s) -> Struct ('Mut s) -> m (Maybe (Ptr ('Mut s)))
forall s a (m :: * -> *).
(ToPtr s a, WriteCtx m s) =>
Message ('Mut s) -> a -> m (Maybe (Ptr ('Mut s)))
Classes.toPtr Message ('Mut s)
msg Struct ('Mut s)
struct)
instance (Classes.Allocate s (Value'Call (Message.Mut s))) where
    new :: Message ('Mut s) -> m (Value'Call ('Mut s))
new Message ('Mut s)
msg = (Struct ('Mut s) -> Value'Call ('Mut s)
forall (msg :: Mutability). Struct msg -> Value'Call msg
Value'Call'newtype_ (Struct ('Mut s) -> Value'Call ('Mut s))
-> m (Struct ('Mut s)) -> m (Value'Call ('Mut s))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Message ('Mut s) -> Word16 -> Word16 -> m (Struct ('Mut s))
forall (m :: * -> *) s.
WriteCtx m s =>
Message ('Mut s) -> Word16 -> Word16 -> m (Struct ('Mut s))
Untyped.allocStruct Message ('Mut s)
msg Word16
0 Word16
2))
instance (Basics.ListElem mut (Value'Call mut)) where
    newtype List mut (Value'Call mut)
        = Value'Call'List_ (Untyped.ListOf mut (Untyped.Struct mut))
    listFromPtr :: Message mut -> Maybe (Ptr mut) -> m (List mut (Value'Call mut))
listFromPtr Message mut
msg Maybe (Ptr mut)
ptr = (ListOf mut (Struct mut) -> List mut (Value'Call mut)
forall (mut :: Mutability).
ListOf mut (Struct mut) -> List mut (Value'Call mut)
Value'Call'List_ (ListOf mut (Struct mut) -> List mut (Value'Call mut))
-> m (ListOf mut (Struct mut)) -> m (List mut (Value'Call mut))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Message mut -> Maybe (Ptr mut) -> m (ListOf mut (Struct mut))
forall (mut :: Mutability) a (m :: * -> *).
(FromPtr mut a, ReadCtx m mut) =>
Message mut -> Maybe (Ptr mut) -> m a
Classes.fromPtr Message mut
msg Maybe (Ptr mut)
ptr))
    toUntypedList :: List mut (Value'Call mut) -> List mut
toUntypedList (Value'Call'List_ l) = (ListOf mut (Struct mut) -> List mut
forall (mut :: Mutability). ListOf mut (Struct mut) -> List mut
Untyped.ListStruct ListOf mut (Struct mut)
l)
    length :: List mut (Value'Call mut) -> Int
length (Value'Call'List_ l) = (ListOf mut (Struct mut) -> Int
forall (msg :: Mutability) a. ListOf msg a -> Int
Untyped.length ListOf mut (Struct mut)
l)
    index :: Int -> List mut (Value'Call mut) -> m (Value'Call mut)
index Int
i (Value'Call'List_ l) = (do
        Struct mut
elt <- (Int -> ListOf mut (Struct mut) -> m (Struct mut)
forall (m :: * -> *) (mut :: Mutability) a.
ReadCtx m mut =>
Int -> ListOf mut a -> m a
Untyped.index Int
i ListOf mut (Struct mut)
l)
        (Struct mut -> m (Value'Call mut)
forall (mut :: Mutability) a (m :: * -> *).
(FromStruct mut a, ReadCtx m mut) =>
Struct mut -> m a
Classes.fromStruct Struct mut
elt)
        )
instance (Basics.MutListElem s (Value'Call (Message.Mut s))) where
    setIndex :: Value'Call ('Mut s)
-> Int -> List ('Mut s) (Value'Call ('Mut s)) -> m ()
setIndex (Value'Call'newtype_ Struct ('Mut s)
elt) Int
i (Value'Call'List_ l) = (Struct ('Mut s) -> Int -> ListOf ('Mut s) (Struct ('Mut s)) -> m ()
forall (m :: * -> *) s a.
RWCtx m s =>
a -> Int -> ListOf ('Mut s) a -> m ()
Untyped.setIndex Struct ('Mut s)
elt Int
i ListOf ('Mut s) (Struct ('Mut s))
l)
    newList :: Message ('Mut s) -> Int -> m (List ('Mut s) (Value'Call ('Mut s)))
newList Message ('Mut s)
msg Int
len = (ListOf ('Mut s) (Struct ('Mut s))
-> List ('Mut s) (Value'Call ('Mut s))
forall (mut :: Mutability).
ListOf mut (Struct mut) -> List mut (Value'Call mut)
Value'Call'List_ (ListOf ('Mut s) (Struct ('Mut s))
 -> List ('Mut s) (Value'Call ('Mut s)))
-> m (ListOf ('Mut s) (Struct ('Mut s)))
-> m (List ('Mut s) (Value'Call ('Mut s)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Message ('Mut s)
-> Word16 -> Word16 -> Int -> m (ListOf ('Mut s) (Struct ('Mut s)))
forall (m :: * -> *) s.
WriteCtx m s =>
Message ('Mut s)
-> Word16 -> Word16 -> Int -> m (ListOf ('Mut s) (Struct ('Mut s)))
Untyped.allocCompositeList Message ('Mut s)
msg Word16
0 Word16
2 Int
len))
get_Value'Call'function :: ((Untyped.ReadCtx m msg)
                           ,(Classes.FromPtr msg (Basics.Text msg))) => (Value'Call msg) -> (m (Basics.Text msg))
get_Value'Call'function :: Value'Call msg -> m (Text msg)
get_Value'Call'function (Value'Call'newtype_ Struct msg
struct) = (do
    Maybe (Ptr msg)
ptr <- (Int -> Struct msg -> m (Maybe (Ptr msg))
forall (m :: * -> *) (msg :: Mutability).
ReadCtx m msg =>
Int -> Struct msg -> m (Maybe (Ptr msg))
Untyped.getPtr Int
0 Struct msg
struct)
    (Message msg -> Maybe (Ptr msg) -> m (Text msg)
forall (mut :: Mutability) a (m :: * -> *).
(FromPtr mut a, ReadCtx m mut) =>
Message mut -> Maybe (Ptr mut) -> m a
Classes.fromPtr (Struct msg -> Message msg
forall a (mut :: Mutability). HasMessage a mut => a -> Message mut
Untyped.message Struct msg
struct) Maybe (Ptr msg)
ptr)
    )
set_Value'Call'function :: ((Untyped.RWCtx m s)
                           ,(Classes.ToPtr s (Basics.Text (Message.Mut s)))) => (Value'Call (Message.Mut s)) -> (Basics.Text (Message.Mut s)) -> (m ())
set_Value'Call'function :: Value'Call ('Mut s) -> Text ('Mut s) -> m ()
set_Value'Call'function (Value'Call'newtype_ Struct ('Mut s)
struct) Text ('Mut s)
value = (do
    Maybe (Ptr ('Mut s))
ptr <- (Message ('Mut s) -> Text ('Mut s) -> m (Maybe (Ptr ('Mut s)))
forall s a (m :: * -> *).
(ToPtr s a, WriteCtx m s) =>
Message ('Mut s) -> a -> m (Maybe (Ptr ('Mut s)))
Classes.toPtr (Struct ('Mut s) -> Message ('Mut s)
forall a (mut :: Mutability). HasMessage a mut => a -> Message mut
Untyped.message Struct ('Mut s)
struct) Text ('Mut s)
value)
    (Maybe (Ptr ('Mut s)) -> Int -> Struct ('Mut s) -> m ()
forall (m :: * -> *) s.
(ReadCtx m ('Mut s), WriteCtx m s) =>
Maybe (Ptr ('Mut s)) -> Int -> Struct ('Mut s) -> m ()
Untyped.setPtr Maybe (Ptr ('Mut s))
ptr Int
0 Struct ('Mut s)
struct)
    )
has_Value'Call'function :: ((Untyped.ReadCtx m msg)) => (Value'Call msg) -> (m Std_.Bool)
has_Value'Call'function :: Value'Call msg -> m Bool
has_Value'Call'function (Value'Call'newtype_ Struct msg
struct) = (Maybe (Ptr msg) -> Bool
forall a. Maybe a -> Bool
Std_.isJust (Maybe (Ptr msg) -> Bool) -> m (Maybe (Ptr msg)) -> m Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Int -> Struct msg -> m (Maybe (Ptr msg))
forall (m :: * -> *) (msg :: Mutability).
ReadCtx m msg =>
Int -> Struct msg -> m (Maybe (Ptr msg))
Untyped.getPtr Int
0 Struct msg
struct))
new_Value'Call'function :: ((Untyped.RWCtx m s)) => Std_.Int -> (Value'Call (Message.Mut s)) -> (m (Basics.Text (Message.Mut s)))
new_Value'Call'function :: Int -> Value'Call ('Mut s) -> m (Text ('Mut s))
new_Value'Call'function Int
len Value'Call ('Mut s)
struct = (do
    Text ('Mut s)
result <- (Message ('Mut s) -> Int -> m (Text ('Mut s))
forall (m :: * -> *) s.
WriteCtx m s =>
Message ('Mut s) -> Int -> m (Text ('Mut s))
Basics.newText (Value'Call ('Mut s) -> Message ('Mut s)
forall a (mut :: Mutability). HasMessage a mut => a -> Message mut
Untyped.message Value'Call ('Mut s)
struct) Int
len)
    (Value'Call ('Mut s) -> Text ('Mut s) -> m ()
forall (m :: * -> *) s.
(RWCtx m s, ToPtr s (Text ('Mut s))) =>
Value'Call ('Mut s) -> Text ('Mut s) -> m ()
set_Value'Call'function Value'Call ('Mut s)
struct Text ('Mut s)
result)
    (Text ('Mut s) -> m (Text ('Mut s))
forall (f :: * -> *) a. Applicative f => a -> f a
Std_.pure Text ('Mut s)
result)
    )
get_Value'Call'params :: ((Untyped.ReadCtx m msg)
                         ,(Classes.FromPtr msg (Basics.List msg (Value msg)))) => (Value'Call msg) -> (m (Basics.List msg (Value msg)))
get_Value'Call'params :: Value'Call msg -> m (List msg (Value msg))
get_Value'Call'params (Value'Call'newtype_ Struct msg
struct) = (do
    Maybe (Ptr msg)
ptr <- (Int -> Struct msg -> m (Maybe (Ptr msg))
forall (m :: * -> *) (msg :: Mutability).
ReadCtx m msg =>
Int -> Struct msg -> m (Maybe (Ptr msg))
Untyped.getPtr Int
1 Struct msg
struct)
    (Message msg -> Maybe (Ptr msg) -> m (List msg (Value msg))
forall (mut :: Mutability) a (m :: * -> *).
(FromPtr mut a, ReadCtx m mut) =>
Message mut -> Maybe (Ptr mut) -> m a
Classes.fromPtr (Struct msg -> Message msg
forall a (mut :: Mutability). HasMessage a mut => a -> Message mut
Untyped.message Struct msg
struct) Maybe (Ptr msg)
ptr)
    )
set_Value'Call'params :: ((Untyped.RWCtx m s)
                         ,(Classes.ToPtr s (Basics.List (Message.Mut s) (Value (Message.Mut s))))) => (Value'Call (Message.Mut s)) -> (Basics.List (Message.Mut s) (Value (Message.Mut s))) -> (m ())
set_Value'Call'params :: Value'Call ('Mut s) -> List ('Mut s) (Value ('Mut s)) -> m ()
set_Value'Call'params (Value'Call'newtype_ Struct ('Mut s)
struct) List ('Mut s) (Value ('Mut s))
value = (do
    Maybe (Ptr ('Mut s))
ptr <- (Message ('Mut s)
-> List ('Mut s) (Value ('Mut s)) -> m (Maybe (Ptr ('Mut s)))
forall s a (m :: * -> *).
(ToPtr s a, WriteCtx m s) =>
Message ('Mut s) -> a -> m (Maybe (Ptr ('Mut s)))
Classes.toPtr (Struct ('Mut s) -> Message ('Mut s)
forall a (mut :: Mutability). HasMessage a mut => a -> Message mut
Untyped.message Struct ('Mut s)
struct) List ('Mut s) (Value ('Mut s))
value)
    (Maybe (Ptr ('Mut s)) -> Int -> Struct ('Mut s) -> m ()
forall (m :: * -> *) s.
(ReadCtx m ('Mut s), WriteCtx m s) =>
Maybe (Ptr ('Mut s)) -> Int -> Struct ('Mut s) -> m ()
Untyped.setPtr Maybe (Ptr ('Mut s))
ptr Int
1 Struct ('Mut s)
struct)
    )
has_Value'Call'params :: ((Untyped.ReadCtx m msg)) => (Value'Call msg) -> (m Std_.Bool)
has_Value'Call'params :: Value'Call msg -> m Bool
has_Value'Call'params (Value'Call'newtype_ Struct msg
struct) = (Maybe (Ptr msg) -> Bool
forall a. Maybe a -> Bool
Std_.isJust (Maybe (Ptr msg) -> Bool) -> m (Maybe (Ptr msg)) -> m Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Int -> Struct msg -> m (Maybe (Ptr msg))
forall (m :: * -> *) (msg :: Mutability).
ReadCtx m msg =>
Int -> Struct msg -> m (Maybe (Ptr msg))
Untyped.getPtr Int
1 Struct msg
struct))
new_Value'Call'params :: ((Untyped.RWCtx m s)) => Std_.Int -> (Value'Call (Message.Mut s)) -> (m (Basics.List (Message.Mut s) (Value (Message.Mut s))))
new_Value'Call'params :: Int -> Value'Call ('Mut s) -> m (List ('Mut s) (Value ('Mut s)))
new_Value'Call'params Int
len Value'Call ('Mut s)
struct = (do
    List ('Mut s) (Value ('Mut s))
result <- (Message ('Mut s) -> Int -> m (List ('Mut s) (Value ('Mut s)))
forall s e (m :: * -> *).
(MutListElem s e, WriteCtx m s) =>
Message ('Mut s) -> Int -> m (List ('Mut s) e)
Classes.newList (Value'Call ('Mut s) -> Message ('Mut s)
forall a (mut :: Mutability). HasMessage a mut => a -> Message mut
Untyped.message Value'Call ('Mut s)
struct) Int
len)
    (Value'Call ('Mut s) -> List ('Mut s) (Value ('Mut s)) -> m ()
forall (m :: * -> *) s.
(RWCtx m s, ToPtr s (List ('Mut s) (Value ('Mut s)))) =>
Value'Call ('Mut s) -> List ('Mut s) (Value ('Mut s)) -> m ()
set_Value'Call'params Value'Call ('Mut s)
struct List ('Mut s) (Value ('Mut s))
result)
    (List ('Mut s) (Value ('Mut s))
-> m (List ('Mut s) (Value ('Mut s)))
forall (f :: * -> *) a. Applicative f => a -> f a
Std_.pure List ('Mut s) (Value ('Mut s))
result)
    )
newtype FlattenOptions msg
    = FlattenOptions'newtype_ (Untyped.Struct msg)
instance (Classes.FromStruct msg (FlattenOptions msg)) where
    fromStruct :: Struct msg -> m (FlattenOptions msg)
fromStruct Struct msg
struct = (FlattenOptions msg -> m (FlattenOptions msg)
forall (f :: * -> *) a. Applicative f => a -> f a
Std_.pure (Struct msg -> FlattenOptions msg
forall (msg :: Mutability). Struct msg -> FlattenOptions msg
FlattenOptions'newtype_ Struct msg
struct))
instance (Classes.ToStruct msg (FlattenOptions msg)) where
    toStruct :: FlattenOptions msg -> Struct msg
toStruct (FlattenOptions'newtype_ Struct msg
struct) = Struct msg
struct
instance (Untyped.HasMessage (FlattenOptions mut) mut) where
    message :: FlattenOptions mut -> Message mut
message (FlattenOptions'newtype_ Struct mut
struct) = (Struct mut -> Message mut
forall a (mut :: Mutability). HasMessage a mut => a -> Message mut
Untyped.message Struct mut
struct)
instance (Untyped.MessageDefault (FlattenOptions mut) mut) where
    messageDefault :: Message mut -> m (FlattenOptions mut)
messageDefault Message mut
msg = (Struct mut -> FlattenOptions mut
forall (msg :: Mutability). Struct msg -> FlattenOptions msg
FlattenOptions'newtype_ (Struct mut -> FlattenOptions mut)
-> m (Struct mut) -> m (FlattenOptions mut)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Message mut -> m (Struct mut)
forall a (mut :: Mutability) (m :: * -> *).
(MessageDefault a mut, ReadCtx m mut) =>
Message mut -> m a
Untyped.messageDefault Message mut
msg))
instance (Classes.FromPtr msg (FlattenOptions msg)) where
    fromPtr :: Message msg -> Maybe (Ptr msg) -> m (FlattenOptions msg)
fromPtr Message msg
msg Maybe (Ptr msg)
ptr = (Struct msg -> FlattenOptions msg
forall (msg :: Mutability). Struct msg -> FlattenOptions msg
FlattenOptions'newtype_ (Struct msg -> FlattenOptions msg)
-> m (Struct msg) -> m (FlattenOptions msg)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Message msg -> Maybe (Ptr msg) -> m (Struct msg)
forall (mut :: Mutability) a (m :: * -> *).
(FromPtr mut a, ReadCtx m mut) =>
Message mut -> Maybe (Ptr mut) -> m a
Classes.fromPtr Message msg
msg Maybe (Ptr msg)
ptr))
instance (Classes.ToPtr s (FlattenOptions (Message.Mut s))) where
    toPtr :: Message ('Mut s)
-> FlattenOptions ('Mut s) -> m (Maybe (Ptr ('Mut s)))
toPtr Message ('Mut s)
msg (FlattenOptions'newtype_ Struct ('Mut s)
struct) = (Message ('Mut s) -> Struct ('Mut s) -> m (Maybe (Ptr ('Mut s)))
forall s a (m :: * -> *).
(ToPtr s a, WriteCtx m s) =>
Message ('Mut s) -> a -> m (Maybe (Ptr ('Mut s)))
Classes.toPtr Message ('Mut s)
msg Struct ('Mut s)
struct)
instance (Classes.Allocate s (FlattenOptions (Message.Mut s))) where
    new :: Message ('Mut s) -> m (FlattenOptions ('Mut s))
new Message ('Mut s)
msg = (Struct ('Mut s) -> FlattenOptions ('Mut s)
forall (msg :: Mutability). Struct msg -> FlattenOptions msg
FlattenOptions'newtype_ (Struct ('Mut s) -> FlattenOptions ('Mut s))
-> m (Struct ('Mut s)) -> m (FlattenOptions ('Mut s))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Message ('Mut s) -> Word16 -> Word16 -> m (Struct ('Mut s))
forall (m :: * -> *) s.
WriteCtx m s =>
Message ('Mut s) -> Word16 -> Word16 -> m (Struct ('Mut s))
Untyped.allocStruct Message ('Mut s)
msg Word16
0 Word16
1))
instance (Basics.ListElem mut (FlattenOptions mut)) where
    newtype List mut (FlattenOptions mut)
        = FlattenOptions'List_ (Untyped.ListOf mut (Untyped.Struct mut))
    listFromPtr :: Message mut -> Maybe (Ptr mut) -> m (List mut (FlattenOptions mut))
listFromPtr Message mut
msg Maybe (Ptr mut)
ptr = (ListOf mut (Struct mut) -> List mut (FlattenOptions mut)
forall (mut :: Mutability).
ListOf mut (Struct mut) -> List mut (FlattenOptions mut)
FlattenOptions'List_ (ListOf mut (Struct mut) -> List mut (FlattenOptions mut))
-> m (ListOf mut (Struct mut)) -> m (List mut (FlattenOptions mut))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Message mut -> Maybe (Ptr mut) -> m (ListOf mut (Struct mut))
forall (mut :: Mutability) a (m :: * -> *).
(FromPtr mut a, ReadCtx m mut) =>
Message mut -> Maybe (Ptr mut) -> m a
Classes.fromPtr Message mut
msg Maybe (Ptr mut)
ptr))
    toUntypedList :: List mut (FlattenOptions mut) -> List mut
toUntypedList (FlattenOptions'List_ l) = (ListOf mut (Struct mut) -> List mut
forall (mut :: Mutability). ListOf mut (Struct mut) -> List mut
Untyped.ListStruct ListOf mut (Struct mut)
l)
    length :: List mut (FlattenOptions mut) -> Int
length (FlattenOptions'List_ l) = (ListOf mut (Struct mut) -> Int
forall (msg :: Mutability) a. ListOf msg a -> Int
Untyped.length ListOf mut (Struct mut)
l)
    index :: Int -> List mut (FlattenOptions mut) -> m (FlattenOptions mut)
index Int
i (FlattenOptions'List_ l) = (do
        Struct mut
elt <- (Int -> ListOf mut (Struct mut) -> m (Struct mut)
forall (m :: * -> *) (mut :: Mutability) a.
ReadCtx m mut =>
Int -> ListOf mut a -> m a
Untyped.index Int
i ListOf mut (Struct mut)
l)
        (Struct mut -> m (FlattenOptions mut)
forall (mut :: Mutability) a (m :: * -> *).
(FromStruct mut a, ReadCtx m mut) =>
Struct mut -> m a
Classes.fromStruct Struct mut
elt)
        )
instance (Basics.MutListElem s (FlattenOptions (Message.Mut s))) where
    setIndex :: FlattenOptions ('Mut s)
-> Int -> List ('Mut s) (FlattenOptions ('Mut s)) -> m ()
setIndex (FlattenOptions'newtype_ Struct ('Mut s)
elt) Int
i (FlattenOptions'List_ l) = (Struct ('Mut s) -> Int -> ListOf ('Mut s) (Struct ('Mut s)) -> m ()
forall (m :: * -> *) s a.
RWCtx m s =>
a -> Int -> ListOf ('Mut s) a -> m ()
Untyped.setIndex Struct ('Mut s)
elt Int
i ListOf ('Mut s) (Struct ('Mut s))
l)
    newList :: Message ('Mut s)
-> Int -> m (List ('Mut s) (FlattenOptions ('Mut s)))
newList Message ('Mut s)
msg Int
len = (ListOf ('Mut s) (Struct ('Mut s))
-> List ('Mut s) (FlattenOptions ('Mut s))
forall (mut :: Mutability).
ListOf mut (Struct mut) -> List mut (FlattenOptions mut)
FlattenOptions'List_ (ListOf ('Mut s) (Struct ('Mut s))
 -> List ('Mut s) (FlattenOptions ('Mut s)))
-> m (ListOf ('Mut s) (Struct ('Mut s)))
-> m (List ('Mut s) (FlattenOptions ('Mut s)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Message ('Mut s)
-> Word16 -> Word16 -> Int -> m (ListOf ('Mut s) (Struct ('Mut s)))
forall (m :: * -> *) s.
WriteCtx m s =>
Message ('Mut s)
-> Word16 -> Word16 -> Int -> m (ListOf ('Mut s) (Struct ('Mut s)))
Untyped.allocCompositeList Message ('Mut s)
msg Word16
0 Word16
1 Int
len))
get_FlattenOptions'prefix :: ((Untyped.ReadCtx m msg)
                             ,(Classes.FromPtr msg (Basics.Text msg))) => (FlattenOptions msg) -> (m (Basics.Text msg))
get_FlattenOptions'prefix :: FlattenOptions msg -> m (Text msg)
get_FlattenOptions'prefix (FlattenOptions'newtype_ Struct msg
struct) = (do
    Maybe (Ptr msg)
ptr <- (Int -> Struct msg -> m (Maybe (Ptr msg))
forall (m :: * -> *) (msg :: Mutability).
ReadCtx m msg =>
Int -> Struct msg -> m (Maybe (Ptr msg))
Untyped.getPtr Int
0 Struct msg
struct)
    (Message msg -> Maybe (Ptr msg) -> m (Text msg)
forall (mut :: Mutability) a (m :: * -> *).
(FromPtr mut a, ReadCtx m mut) =>
Message mut -> Maybe (Ptr mut) -> m a
Classes.fromPtr (Struct msg -> Message msg
forall a (mut :: Mutability). HasMessage a mut => a -> Message mut
Untyped.message Struct msg
struct) Maybe (Ptr msg)
ptr)
    )
set_FlattenOptions'prefix :: ((Untyped.RWCtx m s)
                             ,(Classes.ToPtr s (Basics.Text (Message.Mut s)))) => (FlattenOptions (Message.Mut s)) -> (Basics.Text (Message.Mut s)) -> (m ())
set_FlattenOptions'prefix :: FlattenOptions ('Mut s) -> Text ('Mut s) -> m ()
set_FlattenOptions'prefix (FlattenOptions'newtype_ Struct ('Mut s)
struct) Text ('Mut s)
value = (do
    Maybe (Ptr ('Mut s))
ptr <- (Message ('Mut s) -> Text ('Mut s) -> m (Maybe (Ptr ('Mut s)))
forall s a (m :: * -> *).
(ToPtr s a, WriteCtx m s) =>
Message ('Mut s) -> a -> m (Maybe (Ptr ('Mut s)))
Classes.toPtr (Struct ('Mut s) -> Message ('Mut s)
forall a (mut :: Mutability). HasMessage a mut => a -> Message mut
Untyped.message Struct ('Mut s)
struct) Text ('Mut s)
value)
    (Maybe (Ptr ('Mut s)) -> Int -> Struct ('Mut s) -> m ()
forall (m :: * -> *) s.
(ReadCtx m ('Mut s), WriteCtx m s) =>
Maybe (Ptr ('Mut s)) -> Int -> Struct ('Mut s) -> m ()
Untyped.setPtr Maybe (Ptr ('Mut s))
ptr Int
0 Struct ('Mut s)
struct)
    )
has_FlattenOptions'prefix :: ((Untyped.ReadCtx m msg)) => (FlattenOptions msg) -> (m Std_.Bool)
has_FlattenOptions'prefix :: FlattenOptions msg -> m Bool
has_FlattenOptions'prefix (FlattenOptions'newtype_ Struct msg
struct) = (Maybe (Ptr msg) -> Bool
forall a. Maybe a -> Bool
Std_.isJust (Maybe (Ptr msg) -> Bool) -> m (Maybe (Ptr msg)) -> m Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Int -> Struct msg -> m (Maybe (Ptr msg))
forall (m :: * -> *) (msg :: Mutability).
ReadCtx m msg =>
Int -> Struct msg -> m (Maybe (Ptr msg))
Untyped.getPtr Int
0 Struct msg
struct))
new_FlattenOptions'prefix :: ((Untyped.RWCtx m s)) => Std_.Int -> (FlattenOptions (Message.Mut s)) -> (m (Basics.Text (Message.Mut s)))
new_FlattenOptions'prefix :: Int -> FlattenOptions ('Mut s) -> m (Text ('Mut s))
new_FlattenOptions'prefix Int
len FlattenOptions ('Mut s)
struct = (do
    Text ('Mut s)
result <- (Message ('Mut s) -> Int -> m (Text ('Mut s))
forall (m :: * -> *) s.
WriteCtx m s =>
Message ('Mut s) -> Int -> m (Text ('Mut s))
Basics.newText (FlattenOptions ('Mut s) -> Message ('Mut s)
forall a (mut :: Mutability). HasMessage a mut => a -> Message mut
Untyped.message FlattenOptions ('Mut s)
struct) Int
len)
    (FlattenOptions ('Mut s) -> Text ('Mut s) -> m ()
forall (m :: * -> *) s.
(RWCtx m s, ToPtr s (Text ('Mut s))) =>
FlattenOptions ('Mut s) -> Text ('Mut s) -> m ()
set_FlattenOptions'prefix FlattenOptions ('Mut s)
struct Text ('Mut s)
result)
    (Text ('Mut s) -> m (Text ('Mut s))
forall (f :: * -> *) a. Applicative f => a -> f a
Std_.pure Text ('Mut s)
result)
    )
newtype DiscriminatorOptions msg
    = DiscriminatorOptions'newtype_ (Untyped.Struct msg)
instance (Classes.FromStruct msg (DiscriminatorOptions msg)) where
    fromStruct :: Struct msg -> m (DiscriminatorOptions msg)
fromStruct Struct msg
struct = (DiscriminatorOptions msg -> m (DiscriminatorOptions msg)
forall (f :: * -> *) a. Applicative f => a -> f a
Std_.pure (Struct msg -> DiscriminatorOptions msg
forall (msg :: Mutability). Struct msg -> DiscriminatorOptions msg
DiscriminatorOptions'newtype_ Struct msg
struct))
instance (Classes.ToStruct msg (DiscriminatorOptions msg)) where
    toStruct :: DiscriminatorOptions msg -> Struct msg
toStruct (DiscriminatorOptions'newtype_ Struct msg
struct) = Struct msg
struct
instance (Untyped.HasMessage (DiscriminatorOptions mut) mut) where
    message :: DiscriminatorOptions mut -> Message mut
message (DiscriminatorOptions'newtype_ Struct mut
struct) = (Struct mut -> Message mut
forall a (mut :: Mutability). HasMessage a mut => a -> Message mut
Untyped.message Struct mut
struct)
instance (Untyped.MessageDefault (DiscriminatorOptions mut) mut) where
    messageDefault :: Message mut -> m (DiscriminatorOptions mut)
messageDefault Message mut
msg = (Struct mut -> DiscriminatorOptions mut
forall (msg :: Mutability). Struct msg -> DiscriminatorOptions msg
DiscriminatorOptions'newtype_ (Struct mut -> DiscriminatorOptions mut)
-> m (Struct mut) -> m (DiscriminatorOptions mut)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Message mut -> m (Struct mut)
forall a (mut :: Mutability) (m :: * -> *).
(MessageDefault a mut, ReadCtx m mut) =>
Message mut -> m a
Untyped.messageDefault Message mut
msg))
instance (Classes.FromPtr msg (DiscriminatorOptions msg)) where
    fromPtr :: Message msg -> Maybe (Ptr msg) -> m (DiscriminatorOptions msg)
fromPtr Message msg
msg Maybe (Ptr msg)
ptr = (Struct msg -> DiscriminatorOptions msg
forall (msg :: Mutability). Struct msg -> DiscriminatorOptions msg
DiscriminatorOptions'newtype_ (Struct msg -> DiscriminatorOptions msg)
-> m (Struct msg) -> m (DiscriminatorOptions msg)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Message msg -> Maybe (Ptr msg) -> m (Struct msg)
forall (mut :: Mutability) a (m :: * -> *).
(FromPtr mut a, ReadCtx m mut) =>
Message mut -> Maybe (Ptr mut) -> m a
Classes.fromPtr Message msg
msg Maybe (Ptr msg)
ptr))
instance (Classes.ToPtr s (DiscriminatorOptions (Message.Mut s))) where
    toPtr :: Message ('Mut s)
-> DiscriminatorOptions ('Mut s) -> m (Maybe (Ptr ('Mut s)))
toPtr Message ('Mut s)
msg (DiscriminatorOptions'newtype_ Struct ('Mut s)
struct) = (Message ('Mut s) -> Struct ('Mut s) -> m (Maybe (Ptr ('Mut s)))
forall s a (m :: * -> *).
(ToPtr s a, WriteCtx m s) =>
Message ('Mut s) -> a -> m (Maybe (Ptr ('Mut s)))
Classes.toPtr Message ('Mut s)
msg Struct ('Mut s)
struct)
instance (Classes.Allocate s (DiscriminatorOptions (Message.Mut s))) where
    new :: Message ('Mut s) -> m (DiscriminatorOptions ('Mut s))
new Message ('Mut s)
msg = (Struct ('Mut s) -> DiscriminatorOptions ('Mut s)
forall (msg :: Mutability). Struct msg -> DiscriminatorOptions msg
DiscriminatorOptions'newtype_ (Struct ('Mut s) -> DiscriminatorOptions ('Mut s))
-> m (Struct ('Mut s)) -> m (DiscriminatorOptions ('Mut s))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Message ('Mut s) -> Word16 -> Word16 -> m (Struct ('Mut s))
forall (m :: * -> *) s.
WriteCtx m s =>
Message ('Mut s) -> Word16 -> Word16 -> m (Struct ('Mut s))
Untyped.allocStruct Message ('Mut s)
msg Word16
0 Word16
2))
instance (Basics.ListElem mut (DiscriminatorOptions mut)) where
    newtype List mut (DiscriminatorOptions mut)
        = DiscriminatorOptions'List_ (Untyped.ListOf mut (Untyped.Struct mut))
    listFromPtr :: Message mut
-> Maybe (Ptr mut) -> m (List mut (DiscriminatorOptions mut))
listFromPtr Message mut
msg Maybe (Ptr mut)
ptr = (ListOf mut (Struct mut) -> List mut (DiscriminatorOptions mut)
forall (mut :: Mutability).
ListOf mut (Struct mut) -> List mut (DiscriminatorOptions mut)
DiscriminatorOptions'List_ (ListOf mut (Struct mut) -> List mut (DiscriminatorOptions mut))
-> m (ListOf mut (Struct mut))
-> m (List mut (DiscriminatorOptions mut))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Message mut -> Maybe (Ptr mut) -> m (ListOf mut (Struct mut))
forall (mut :: Mutability) a (m :: * -> *).
(FromPtr mut a, ReadCtx m mut) =>
Message mut -> Maybe (Ptr mut) -> m a
Classes.fromPtr Message mut
msg Maybe (Ptr mut)
ptr))
    toUntypedList :: List mut (DiscriminatorOptions mut) -> List mut
toUntypedList (DiscriminatorOptions'List_ l) = (ListOf mut (Struct mut) -> List mut
forall (mut :: Mutability). ListOf mut (Struct mut) -> List mut
Untyped.ListStruct ListOf mut (Struct mut)
l)
    length :: List mut (DiscriminatorOptions mut) -> Int
length (DiscriminatorOptions'List_ l) = (ListOf mut (Struct mut) -> Int
forall (msg :: Mutability) a. ListOf msg a -> Int
Untyped.length ListOf mut (Struct mut)
l)
    index :: Int
-> List mut (DiscriminatorOptions mut)
-> m (DiscriminatorOptions mut)
index Int
i (DiscriminatorOptions'List_ l) = (do
        Struct mut
elt <- (Int -> ListOf mut (Struct mut) -> m (Struct mut)
forall (m :: * -> *) (mut :: Mutability) a.
ReadCtx m mut =>
Int -> ListOf mut a -> m a
Untyped.index Int
i ListOf mut (Struct mut)
l)
        (Struct mut -> m (DiscriminatorOptions mut)
forall (mut :: Mutability) a (m :: * -> *).
(FromStruct mut a, ReadCtx m mut) =>
Struct mut -> m a
Classes.fromStruct Struct mut
elt)
        )
instance (Basics.MutListElem s (DiscriminatorOptions (Message.Mut s))) where
    setIndex :: DiscriminatorOptions ('Mut s)
-> Int -> List ('Mut s) (DiscriminatorOptions ('Mut s)) -> m ()
setIndex (DiscriminatorOptions'newtype_ Struct ('Mut s)
elt) Int
i (DiscriminatorOptions'List_ l) = (Struct ('Mut s) -> Int -> ListOf ('Mut s) (Struct ('Mut s)) -> m ()
forall (m :: * -> *) s a.
RWCtx m s =>
a -> Int -> ListOf ('Mut s) a -> m ()
Untyped.setIndex Struct ('Mut s)
elt Int
i ListOf ('Mut s) (Struct ('Mut s))
l)
    newList :: Message ('Mut s)
-> Int -> m (List ('Mut s) (DiscriminatorOptions ('Mut s)))
newList Message ('Mut s)
msg Int
len = (ListOf ('Mut s) (Struct ('Mut s))
-> List ('Mut s) (DiscriminatorOptions ('Mut s))
forall (mut :: Mutability).
ListOf mut (Struct mut) -> List mut (DiscriminatorOptions mut)
DiscriminatorOptions'List_ (ListOf ('Mut s) (Struct ('Mut s))
 -> List ('Mut s) (DiscriminatorOptions ('Mut s)))
-> m (ListOf ('Mut s) (Struct ('Mut s)))
-> m (List ('Mut s) (DiscriminatorOptions ('Mut s)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Message ('Mut s)
-> Word16 -> Word16 -> Int -> m (ListOf ('Mut s) (Struct ('Mut s)))
forall (m :: * -> *) s.
WriteCtx m s =>
Message ('Mut s)
-> Word16 -> Word16 -> Int -> m (ListOf ('Mut s) (Struct ('Mut s)))
Untyped.allocCompositeList Message ('Mut s)
msg Word16
0 Word16
2 Int
len))
get_DiscriminatorOptions'name :: ((Untyped.ReadCtx m msg)
                                 ,(Classes.FromPtr msg (Basics.Text msg))) => (DiscriminatorOptions msg) -> (m (Basics.Text msg))
get_DiscriminatorOptions'name :: DiscriminatorOptions msg -> m (Text msg)
get_DiscriminatorOptions'name (DiscriminatorOptions'newtype_ Struct msg
struct) = (do
    Maybe (Ptr msg)
ptr <- (Int -> Struct msg -> m (Maybe (Ptr msg))
forall (m :: * -> *) (msg :: Mutability).
ReadCtx m msg =>
Int -> Struct msg -> m (Maybe (Ptr msg))
Untyped.getPtr Int
0 Struct msg
struct)
    (Message msg -> Maybe (Ptr msg) -> m (Text msg)
forall (mut :: Mutability) a (m :: * -> *).
(FromPtr mut a, ReadCtx m mut) =>
Message mut -> Maybe (Ptr mut) -> m a
Classes.fromPtr (Struct msg -> Message msg
forall a (mut :: Mutability). HasMessage a mut => a -> Message mut
Untyped.message Struct msg
struct) Maybe (Ptr msg)
ptr)
    )
set_DiscriminatorOptions'name :: ((Untyped.RWCtx m s)
                                 ,(Classes.ToPtr s (Basics.Text (Message.Mut s)))) => (DiscriminatorOptions (Message.Mut s)) -> (Basics.Text (Message.Mut s)) -> (m ())
set_DiscriminatorOptions'name :: DiscriminatorOptions ('Mut s) -> Text ('Mut s) -> m ()
set_DiscriminatorOptions'name (DiscriminatorOptions'newtype_ Struct ('Mut s)
struct) Text ('Mut s)
value = (do
    Maybe (Ptr ('Mut s))
ptr <- (Message ('Mut s) -> Text ('Mut s) -> m (Maybe (Ptr ('Mut s)))
forall s a (m :: * -> *).
(ToPtr s a, WriteCtx m s) =>
Message ('Mut s) -> a -> m (Maybe (Ptr ('Mut s)))
Classes.toPtr (Struct ('Mut s) -> Message ('Mut s)
forall a (mut :: Mutability). HasMessage a mut => a -> Message mut
Untyped.message Struct ('Mut s)
struct) Text ('Mut s)
value)
    (Maybe (Ptr ('Mut s)) -> Int -> Struct ('Mut s) -> m ()
forall (m :: * -> *) s.
(ReadCtx m ('Mut s), WriteCtx m s) =>
Maybe (Ptr ('Mut s)) -> Int -> Struct ('Mut s) -> m ()
Untyped.setPtr Maybe (Ptr ('Mut s))
ptr Int
0 Struct ('Mut s)
struct)
    )
has_DiscriminatorOptions'name :: ((Untyped.ReadCtx m msg)) => (DiscriminatorOptions msg) -> (m Std_.Bool)
has_DiscriminatorOptions'name :: DiscriminatorOptions msg -> m Bool
has_DiscriminatorOptions'name (DiscriminatorOptions'newtype_ Struct msg
struct) = (Maybe (Ptr msg) -> Bool
forall a. Maybe a -> Bool
Std_.isJust (Maybe (Ptr msg) -> Bool) -> m (Maybe (Ptr msg)) -> m Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Int -> Struct msg -> m (Maybe (Ptr msg))
forall (m :: * -> *) (msg :: Mutability).
ReadCtx m msg =>
Int -> Struct msg -> m (Maybe (Ptr msg))
Untyped.getPtr Int
0 Struct msg
struct))
new_DiscriminatorOptions'name :: ((Untyped.RWCtx m s)) => Std_.Int -> (DiscriminatorOptions (Message.Mut s)) -> (m (Basics.Text (Message.Mut s)))
new_DiscriminatorOptions'name :: Int -> DiscriminatorOptions ('Mut s) -> m (Text ('Mut s))
new_DiscriminatorOptions'name Int
len DiscriminatorOptions ('Mut s)
struct = (do
    Text ('Mut s)
result <- (Message ('Mut s) -> Int -> m (Text ('Mut s))
forall (m :: * -> *) s.
WriteCtx m s =>
Message ('Mut s) -> Int -> m (Text ('Mut s))
Basics.newText (DiscriminatorOptions ('Mut s) -> Message ('Mut s)
forall a (mut :: Mutability). HasMessage a mut => a -> Message mut
Untyped.message DiscriminatorOptions ('Mut s)
struct) Int
len)
    (DiscriminatorOptions ('Mut s) -> Text ('Mut s) -> m ()
forall (m :: * -> *) s.
(RWCtx m s, ToPtr s (Text ('Mut s))) =>
DiscriminatorOptions ('Mut s) -> Text ('Mut s) -> m ()
set_DiscriminatorOptions'name DiscriminatorOptions ('Mut s)
struct Text ('Mut s)
result)
    (Text ('Mut s) -> m (Text ('Mut s))
forall (f :: * -> *) a. Applicative f => a -> f a
Std_.pure Text ('Mut s)
result)
    )
get_DiscriminatorOptions'valueName :: ((Untyped.ReadCtx m msg)
                                      ,(Classes.FromPtr msg (Basics.Text msg))) => (DiscriminatorOptions msg) -> (m (Basics.Text msg))
get_DiscriminatorOptions'valueName :: DiscriminatorOptions msg -> m (Text msg)
get_DiscriminatorOptions'valueName (DiscriminatorOptions'newtype_ Struct msg
struct) = (do
    Maybe (Ptr msg)
ptr <- (Int -> Struct msg -> m (Maybe (Ptr msg))
forall (m :: * -> *) (msg :: Mutability).
ReadCtx m msg =>
Int -> Struct msg -> m (Maybe (Ptr msg))
Untyped.getPtr Int
1 Struct msg
struct)
    (Message msg -> Maybe (Ptr msg) -> m (Text msg)
forall (mut :: Mutability) a (m :: * -> *).
(FromPtr mut a, ReadCtx m mut) =>
Message mut -> Maybe (Ptr mut) -> m a
Classes.fromPtr (Struct msg -> Message msg
forall a (mut :: Mutability). HasMessage a mut => a -> Message mut
Untyped.message Struct msg
struct) Maybe (Ptr msg)
ptr)
    )
set_DiscriminatorOptions'valueName :: ((Untyped.RWCtx m s)
                                      ,(Classes.ToPtr s (Basics.Text (Message.Mut s)))) => (DiscriminatorOptions (Message.Mut s)) -> (Basics.Text (Message.Mut s)) -> (m ())
set_DiscriminatorOptions'valueName :: DiscriminatorOptions ('Mut s) -> Text ('Mut s) -> m ()
set_DiscriminatorOptions'valueName (DiscriminatorOptions'newtype_ Struct ('Mut s)
struct) Text ('Mut s)
value = (do
    Maybe (Ptr ('Mut s))
ptr <- (Message ('Mut s) -> Text ('Mut s) -> m (Maybe (Ptr ('Mut s)))
forall s a (m :: * -> *).
(ToPtr s a, WriteCtx m s) =>
Message ('Mut s) -> a -> m (Maybe (Ptr ('Mut s)))
Classes.toPtr (Struct ('Mut s) -> Message ('Mut s)
forall a (mut :: Mutability). HasMessage a mut => a -> Message mut
Untyped.message Struct ('Mut s)
struct) Text ('Mut s)
value)
    (Maybe (Ptr ('Mut s)) -> Int -> Struct ('Mut s) -> m ()
forall (m :: * -> *) s.
(ReadCtx m ('Mut s), WriteCtx m s) =>
Maybe (Ptr ('Mut s)) -> Int -> Struct ('Mut s) -> m ()
Untyped.setPtr Maybe (Ptr ('Mut s))
ptr Int
1 Struct ('Mut s)
struct)
    )
has_DiscriminatorOptions'valueName :: ((Untyped.ReadCtx m msg)) => (DiscriminatorOptions msg) -> (m Std_.Bool)
has_DiscriminatorOptions'valueName :: DiscriminatorOptions msg -> m Bool
has_DiscriminatorOptions'valueName (DiscriminatorOptions'newtype_ Struct msg
struct) = (Maybe (Ptr msg) -> Bool
forall a. Maybe a -> Bool
Std_.isJust (Maybe (Ptr msg) -> Bool) -> m (Maybe (Ptr msg)) -> m Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Int -> Struct msg -> m (Maybe (Ptr msg))
forall (m :: * -> *) (msg :: Mutability).
ReadCtx m msg =>
Int -> Struct msg -> m (Maybe (Ptr msg))
Untyped.getPtr Int
1 Struct msg
struct))
new_DiscriminatorOptions'valueName :: ((Untyped.RWCtx m s)) => Std_.Int -> (DiscriminatorOptions (Message.Mut s)) -> (m (Basics.Text (Message.Mut s)))
new_DiscriminatorOptions'valueName :: Int -> DiscriminatorOptions ('Mut s) -> m (Text ('Mut s))
new_DiscriminatorOptions'valueName Int
len DiscriminatorOptions ('Mut s)
struct = (do
    Text ('Mut s)
result <- (Message ('Mut s) -> Int -> m (Text ('Mut s))
forall (m :: * -> *) s.
WriteCtx m s =>
Message ('Mut s) -> Int -> m (Text ('Mut s))
Basics.newText (DiscriminatorOptions ('Mut s) -> Message ('Mut s)
forall a (mut :: Mutability). HasMessage a mut => a -> Message mut
Untyped.message DiscriminatorOptions ('Mut s)
struct) Int
len)
    (DiscriminatorOptions ('Mut s) -> Text ('Mut s) -> m ()
forall (m :: * -> *) s.
(RWCtx m s, ToPtr s (Text ('Mut s))) =>
DiscriminatorOptions ('Mut s) -> Text ('Mut s) -> m ()
set_DiscriminatorOptions'valueName DiscriminatorOptions ('Mut s)
struct Text ('Mut s)
result)
    (Text ('Mut s) -> m (Text ('Mut s))
forall (f :: * -> *) a. Applicative f => a -> f a
Std_.pure Text ('Mut s)
result)
    )