garnet/generated/GarnetRs.hs

942 lines
25 KiB
Haskell
Raw Normal View History

{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UnboxedTuples #-}
{-# LANGUAGE UndecidableInstances #-}
module GarnetRs where
import qualified Data.Array.Byte
import qualified Data.List.NonEmpty
import qualified Data.Primitive.Types
import qualified Data.Proxy
import qualified Foreign as F
import qualified Foreign.C as FC
import qualified GHC.Generics
import qualified GHC.Ptr as Ptr
import qualified GHC.Records
import qualified HsBindgen.Runtime.CEnum
import qualified HsBindgen.Runtime.HasCField
import qualified HsBindgen.Runtime.Internal.ByteArray
import qualified HsBindgen.Runtime.Internal.HasFFIType
import qualified HsBindgen.Runtime.Internal.SizedByteArray
import qualified HsBindgen.Runtime.LibC
import qualified HsBindgen.Runtime.Marshal
2026-02-19 20:44:04 +00:00
import qualified HsBindgen.Runtime.PtrConst
import qualified Text.Read
import HsBindgen.Runtime.Internal.TypeEquality (TyEq)
import Prelude ((<*>), (>>), Eq, Int, Ord, Read, Show, pure, showsPrec)
{-| __C declaration:__ @struct T@
__defined at:__ @garnet_rs.h 6:8@
__exported by:__ @garnet_rs.h@
-}
data T = T
{ a :: FC.CBool
{- ^ __C declaration:__ @a@
__defined at:__ @garnet_rs.h 7:8@
__exported by:__ @garnet_rs.h@
-}
, b :: HsBindgen.Runtime.LibC.Word8
{- ^ __C declaration:__ @b@
__defined at:__ @garnet_rs.h 8:11@
__exported by:__ @garnet_rs.h@
-}
}
deriving stock (GHC.Generics.Generic)
deriving stock (Eq, Show)
instance HsBindgen.Runtime.Marshal.StaticSize T where
staticSizeOf = \_ -> (2 :: Int)
staticAlignment = \_ -> (1 :: Int)
instance HsBindgen.Runtime.Marshal.ReadRaw T where
readRaw =
\ptr0 ->
pure T
<*> HsBindgen.Runtime.HasCField.readRaw (Data.Proxy.Proxy @"a") ptr0
<*> HsBindgen.Runtime.HasCField.readRaw (Data.Proxy.Proxy @"b") ptr0
instance HsBindgen.Runtime.Marshal.WriteRaw T where
writeRaw =
\ptr0 ->
\s1 ->
case s1 of
T a2 b3 ->
HsBindgen.Runtime.HasCField.writeRaw (Data.Proxy.Proxy @"a") ptr0 a2
>> HsBindgen.Runtime.HasCField.writeRaw (Data.Proxy.Proxy @"b") ptr0 b3
deriving via HsBindgen.Runtime.Marshal.EquivStorable T instance F.Storable T
instance HsBindgen.Runtime.HasCField.HasCField T "a" where
type CFieldType T "a" = FC.CBool
offset# = \_ -> \_ -> 0
instance ( TyEq ty ((HsBindgen.Runtime.HasCField.CFieldType T) "a")
) => GHC.Records.HasField "a" (Ptr.Ptr T) (Ptr.Ptr ty) where
getField =
HsBindgen.Runtime.HasCField.fromPtr (Data.Proxy.Proxy @"a")
instance HsBindgen.Runtime.HasCField.HasCField T "b" where
type CFieldType T "b" = HsBindgen.Runtime.LibC.Word8
offset# = \_ -> \_ -> 1
instance ( TyEq ty ((HsBindgen.Runtime.HasCField.CFieldType T) "b")
) => GHC.Records.HasField "b" (Ptr.Ptr T) (Ptr.Ptr ty) where
getField =
HsBindgen.Runtime.HasCField.fromPtr (Data.Proxy.Proxy @"b")
{-| __C declaration:__ @enum Shape_Tag@
__defined at:__ @garnet_rs.h 11:6@
__exported by:__ @garnet_rs.h@
-}
newtype Shape_Tag = Shape_Tag
{ unwrap :: FC.CUInt
}
deriving stock (GHC.Generics.Generic)
deriving stock (Eq, Ord)
deriving newtype (HsBindgen.Runtime.Internal.HasFFIType.HasFFIType)
instance HsBindgen.Runtime.Marshal.StaticSize Shape_Tag where
staticSizeOf = \_ -> (4 :: Int)
staticAlignment = \_ -> (4 :: Int)
instance HsBindgen.Runtime.Marshal.ReadRaw Shape_Tag where
readRaw =
\ptr0 ->
pure Shape_Tag
<*> HsBindgen.Runtime.Marshal.readRawByteOff ptr0 (0 :: Int)
instance HsBindgen.Runtime.Marshal.WriteRaw Shape_Tag where
writeRaw =
\ptr0 ->
\s1 ->
case s1 of
Shape_Tag unwrap2 ->
HsBindgen.Runtime.Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
deriving via HsBindgen.Runtime.Marshal.EquivStorable Shape_Tag instance F.Storable Shape_Tag
deriving via FC.CUInt instance Data.Primitive.Types.Prim Shape_Tag
instance HsBindgen.Runtime.CEnum.CEnum Shape_Tag where
type CEnumZ Shape_Tag = FC.CUInt
toCEnum = Shape_Tag
fromCEnum = GHC.Records.getField @"unwrap"
declaredValues =
\_ ->
HsBindgen.Runtime.CEnum.declaredValuesFromList [ (0, Data.List.NonEmpty.singleton "Circle")
, (1, Data.List.NonEmpty.singleton "Rectangle")
]
showsUndeclared =
HsBindgen.Runtime.CEnum.showsWrappedUndeclared "Shape_Tag"
readPrecUndeclared =
HsBindgen.Runtime.CEnum.readPrecWrappedUndeclared "Shape_Tag"
isDeclared = HsBindgen.Runtime.CEnum.seqIsDeclared
mkDeclared = HsBindgen.Runtime.CEnum.seqMkDeclared
instance HsBindgen.Runtime.CEnum.SequentialCEnum Shape_Tag where
minDeclaredValue = Circle
maxDeclaredValue = Rectangle
instance Show Shape_Tag where
showsPrec = HsBindgen.Runtime.CEnum.shows
instance Read Shape_Tag where
readPrec = HsBindgen.Runtime.CEnum.readPrec
readList = Text.Read.readListDefault
readListPrec = Text.Read.readListPrecDefault
instance ( TyEq ty ((HsBindgen.Runtime.HasCField.CFieldType Shape_Tag) "unwrap")
) => GHC.Records.HasField "unwrap" (Ptr.Ptr Shape_Tag) (Ptr.Ptr ty) where
getField =
HsBindgen.Runtime.HasCField.fromPtr (Data.Proxy.Proxy @"unwrap")
instance HsBindgen.Runtime.HasCField.HasCField Shape_Tag "unwrap" where
type CFieldType Shape_Tag "unwrap" = FC.CUInt
offset# = \_ -> \_ -> 0
{-| __C declaration:__ @Circle@
__defined at:__ @garnet_rs.h 12:3@
__exported by:__ @garnet_rs.h@
-}
pattern Circle :: Shape_Tag
pattern Circle = Shape_Tag 0
{-| __C declaration:__ @Rectangle@
__defined at:__ @garnet_rs.h 13:3@
__exported by:__ @garnet_rs.h@
-}
pattern Rectangle :: Shape_Tag
pattern Rectangle = Shape_Tag 1
{-| __C declaration:__ @struct Circle_Body@
__defined at:__ @garnet_rs.h 16:8@
__exported by:__ @garnet_rs.h@
-}
data Circle_Body = Circle_Body
{ radius :: FC.CDouble
{- ^ __C declaration:__ @radius@
__defined at:__ @garnet_rs.h 17:10@
__exported by:__ @garnet_rs.h@
-}
}
deriving stock (GHC.Generics.Generic)
deriving stock (Eq, Show)
instance HsBindgen.Runtime.Marshal.StaticSize Circle_Body where
staticSizeOf = \_ -> (8 :: Int)
staticAlignment = \_ -> (8 :: Int)
instance HsBindgen.Runtime.Marshal.ReadRaw Circle_Body where
readRaw =
\ptr0 ->
pure Circle_Body
<*> HsBindgen.Runtime.HasCField.readRaw (Data.Proxy.Proxy @"radius") ptr0
instance HsBindgen.Runtime.Marshal.WriteRaw Circle_Body where
writeRaw =
\ptr0 ->
\s1 ->
case s1 of
Circle_Body radius2 ->
HsBindgen.Runtime.HasCField.writeRaw (Data.Proxy.Proxy @"radius") ptr0 radius2
deriving via HsBindgen.Runtime.Marshal.EquivStorable Circle_Body instance F.Storable Circle_Body
instance HsBindgen.Runtime.HasCField.HasCField Circle_Body "radius" where
type CFieldType Circle_Body "radius" = FC.CDouble
offset# = \_ -> \_ -> 0
instance ( TyEq ty ((HsBindgen.Runtime.HasCField.CFieldType Circle_Body) "radius")
) => GHC.Records.HasField "radius" (Ptr.Ptr Circle_Body) (Ptr.Ptr ty) where
getField =
HsBindgen.Runtime.HasCField.fromPtr (Data.Proxy.Proxy @"radius")
{-| __C declaration:__ @struct Rectangle_Body@
__defined at:__ @garnet_rs.h 20:8@
__exported by:__ @garnet_rs.h@
-}
data Rectangle_Body = Rectangle_Body
{ width :: FC.CDouble
{- ^ __C declaration:__ @width@
__defined at:__ @garnet_rs.h 21:10@
__exported by:__ @garnet_rs.h@
-}
, height :: FC.CDouble
{- ^ __C declaration:__ @height@
__defined at:__ @garnet_rs.h 22:10@
__exported by:__ @garnet_rs.h@
-}
}
deriving stock (GHC.Generics.Generic)
deriving stock (Eq, Show)
instance HsBindgen.Runtime.Marshal.StaticSize Rectangle_Body where
staticSizeOf = \_ -> (16 :: Int)
staticAlignment = \_ -> (8 :: Int)
instance HsBindgen.Runtime.Marshal.ReadRaw Rectangle_Body where
readRaw =
\ptr0 ->
pure Rectangle_Body
<*> HsBindgen.Runtime.HasCField.readRaw (Data.Proxy.Proxy @"width") ptr0
<*> HsBindgen.Runtime.HasCField.readRaw (Data.Proxy.Proxy @"height") ptr0
instance HsBindgen.Runtime.Marshal.WriteRaw Rectangle_Body where
writeRaw =
\ptr0 ->
\s1 ->
case s1 of
Rectangle_Body width2 height3 ->
HsBindgen.Runtime.HasCField.writeRaw (Data.Proxy.Proxy @"width") ptr0 width2
>> HsBindgen.Runtime.HasCField.writeRaw (Data.Proxy.Proxy @"height") ptr0 height3
deriving via HsBindgen.Runtime.Marshal.EquivStorable Rectangle_Body instance F.Storable Rectangle_Body
instance HsBindgen.Runtime.HasCField.HasCField Rectangle_Body "width" where
type CFieldType Rectangle_Body "width" = FC.CDouble
offset# = \_ -> \_ -> 0
instance ( TyEq ty ((HsBindgen.Runtime.HasCField.CFieldType Rectangle_Body) "width")
) => GHC.Records.HasField "width" (Ptr.Ptr Rectangle_Body) (Ptr.Ptr ty) where
getField =
HsBindgen.Runtime.HasCField.fromPtr (Data.Proxy.Proxy @"width")
instance HsBindgen.Runtime.HasCField.HasCField Rectangle_Body "height" where
type CFieldType Rectangle_Body "height" = FC.CDouble
offset# = \_ -> \_ -> 8
instance ( TyEq ty ((HsBindgen.Runtime.HasCField.CFieldType Rectangle_Body) "height")
) => GHC.Records.HasField "height" (Ptr.Ptr Rectangle_Body) (Ptr.Ptr ty) where
getField =
HsBindgen.Runtime.HasCField.fromPtr (Data.Proxy.Proxy @"height")
{-| __C declaration:__ @union \@Shape_body@
__defined at:__ @garnet_rs.h 27:3@
__exported by:__ @garnet_rs.h@
-}
newtype Shape_body = Shape_body
{ unwrap :: Data.Array.Byte.ByteArray
}
deriving stock (GHC.Generics.Generic)
deriving via (HsBindgen.Runtime.Internal.SizedByteArray.SizedByteArray 16) 8 instance HsBindgen.Runtime.Marshal.StaticSize Shape_body
deriving via (HsBindgen.Runtime.Internal.SizedByteArray.SizedByteArray 16) 8 instance HsBindgen.Runtime.Marshal.ReadRaw Shape_body
deriving via (HsBindgen.Runtime.Internal.SizedByteArray.SizedByteArray 16) 8 instance HsBindgen.Runtime.Marshal.WriteRaw Shape_body
deriving via HsBindgen.Runtime.Marshal.EquivStorable Shape_body instance F.Storable Shape_body
{-|
__See:__ 'set_shape_body_circle'
__C declaration:__ @circle@
__defined at:__ @garnet_rs.h 28:24@
__exported by:__ @garnet_rs.h@
-}
get_shape_body_circle ::
Shape_body
-> Circle_Body
get_shape_body_circle =
HsBindgen.Runtime.Internal.ByteArray.getUnionPayload
{-|
__See:__ 'get_shape_body_circle'
-}
set_shape_body_circle ::
Circle_Body
-> Shape_body
set_shape_body_circle =
HsBindgen.Runtime.Internal.ByteArray.setUnionPayload
{-|
__See:__ 'set_shape_body_rectangle'
__C declaration:__ @rectangle@
__defined at:__ @garnet_rs.h 29:27@
__exported by:__ @garnet_rs.h@
-}
get_shape_body_rectangle ::
Shape_body
-> Rectangle_Body
get_shape_body_rectangle =
HsBindgen.Runtime.Internal.ByteArray.getUnionPayload
{-|
__See:__ 'get_shape_body_rectangle'
-}
set_shape_body_rectangle ::
Rectangle_Body
-> Shape_body
set_shape_body_rectangle =
HsBindgen.Runtime.Internal.ByteArray.setUnionPayload
instance HsBindgen.Runtime.HasCField.HasCField Shape_body "circle" where
type CFieldType Shape_body "circle" = Circle_Body
offset# = \_ -> \_ -> 0
instance ( TyEq ty ((HsBindgen.Runtime.HasCField.CFieldType Shape_body) "circle")
) => GHC.Records.HasField "circle" (Ptr.Ptr Shape_body) (Ptr.Ptr ty) where
getField =
HsBindgen.Runtime.HasCField.fromPtr (Data.Proxy.Proxy @"circle")
instance HsBindgen.Runtime.HasCField.HasCField Shape_body "rectangle" where
type CFieldType Shape_body "rectangle" =
Rectangle_Body
offset# = \_ -> \_ -> 0
instance ( TyEq ty ((HsBindgen.Runtime.HasCField.CFieldType Shape_body) "rectangle")
) => GHC.Records.HasField "rectangle" (Ptr.Ptr Shape_body) (Ptr.Ptr ty) where
getField =
HsBindgen.Runtime.HasCField.fromPtr (Data.Proxy.Proxy @"rectangle")
{-| __C declaration:__ @struct Shape@
__defined at:__ @garnet_rs.h 25:8@
__exported by:__ @garnet_rs.h@
-}
data Shape = Shape
{ tag :: Shape_Tag
{- ^ __C declaration:__ @tag@
__defined at:__ @garnet_rs.h 26:18@
__exported by:__ @garnet_rs.h@
-}
, body :: Shape_body
{- ^ __C declaration:__ @body@
__defined at:__ @garnet_rs.h 30:5@
__exported by:__ @garnet_rs.h@
-}
}
deriving stock (GHC.Generics.Generic)
instance HsBindgen.Runtime.Marshal.StaticSize Shape where
staticSizeOf = \_ -> (24 :: Int)
staticAlignment = \_ -> (8 :: Int)
instance HsBindgen.Runtime.Marshal.ReadRaw Shape where
readRaw =
\ptr0 ->
pure Shape
<*> HsBindgen.Runtime.HasCField.readRaw (Data.Proxy.Proxy @"tag") ptr0
<*> HsBindgen.Runtime.HasCField.readRaw (Data.Proxy.Proxy @"body") ptr0
instance HsBindgen.Runtime.Marshal.WriteRaw Shape where
writeRaw =
\ptr0 ->
\s1 ->
case s1 of
Shape tag2 body3 ->
HsBindgen.Runtime.HasCField.writeRaw (Data.Proxy.Proxy @"tag") ptr0 tag2
>> HsBindgen.Runtime.HasCField.writeRaw (Data.Proxy.Proxy @"body") ptr0 body3
deriving via HsBindgen.Runtime.Marshal.EquivStorable Shape instance F.Storable Shape
instance HsBindgen.Runtime.HasCField.HasCField Shape "tag" where
type CFieldType Shape "tag" = Shape_Tag
offset# = \_ -> \_ -> 0
instance ( TyEq ty ((HsBindgen.Runtime.HasCField.CFieldType Shape) "tag")
) => GHC.Records.HasField "tag" (Ptr.Ptr Shape) (Ptr.Ptr ty) where
getField =
HsBindgen.Runtime.HasCField.fromPtr (Data.Proxy.Proxy @"tag")
instance HsBindgen.Runtime.HasCField.HasCField Shape "body" where
type CFieldType Shape "body" = Shape_body
offset# = \_ -> \_ -> 8
instance ( TyEq ty ((HsBindgen.Runtime.HasCField.CFieldType Shape) "body")
) => GHC.Records.HasField "body" (Ptr.Ptr Shape) (Ptr.Ptr ty) where
getField =
HsBindgen.Runtime.HasCField.fromPtr (Data.Proxy.Proxy @"body")
2026-02-19 20:44:04 +00:00
{-| __C declaration:__ @enum BTree_Tag@
__defined at:__ @garnet_rs.h 33:6@
__exported by:__ @garnet_rs.h@
-}
newtype BTree_Tag = BTree_Tag
{ unwrap :: FC.CUInt
}
deriving stock (GHC.Generics.Generic)
deriving stock (Eq, Ord)
deriving newtype (HsBindgen.Runtime.Internal.HasFFIType.HasFFIType)
instance HsBindgen.Runtime.Marshal.StaticSize BTree_Tag where
staticSizeOf = \_ -> (4 :: Int)
staticAlignment = \_ -> (4 :: Int)
instance HsBindgen.Runtime.Marshal.ReadRaw BTree_Tag where
readRaw =
\ptr0 ->
pure BTree_Tag
<*> HsBindgen.Runtime.Marshal.readRawByteOff ptr0 (0 :: Int)
instance HsBindgen.Runtime.Marshal.WriteRaw BTree_Tag where
writeRaw =
\ptr0 ->
\s1 ->
case s1 of
BTree_Tag unwrap2 ->
HsBindgen.Runtime.Marshal.writeRawByteOff ptr0 (0 :: Int) unwrap2
deriving via HsBindgen.Runtime.Marshal.EquivStorable BTree_Tag instance F.Storable BTree_Tag
deriving via FC.CUInt instance Data.Primitive.Types.Prim BTree_Tag
instance HsBindgen.Runtime.CEnum.CEnum BTree_Tag where
type CEnumZ BTree_Tag = FC.CUInt
toCEnum = BTree_Tag
fromCEnum = GHC.Records.getField @"unwrap"
declaredValues =
\_ ->
HsBindgen.Runtime.CEnum.declaredValuesFromList [ (0, Data.List.NonEmpty.singleton "Leaf")
, (1, Data.List.NonEmpty.singleton "Fork")
]
showsUndeclared =
HsBindgen.Runtime.CEnum.showsWrappedUndeclared "BTree_Tag"
readPrecUndeclared =
HsBindgen.Runtime.CEnum.readPrecWrappedUndeclared "BTree_Tag"
isDeclared = HsBindgen.Runtime.CEnum.seqIsDeclared
mkDeclared = HsBindgen.Runtime.CEnum.seqMkDeclared
instance HsBindgen.Runtime.CEnum.SequentialCEnum BTree_Tag where
minDeclaredValue = Leaf
maxDeclaredValue = Fork
instance Show BTree_Tag where
showsPrec = HsBindgen.Runtime.CEnum.shows
instance Read BTree_Tag where
readPrec = HsBindgen.Runtime.CEnum.readPrec
readList = Text.Read.readListDefault
readListPrec = Text.Read.readListPrecDefault
instance ( TyEq ty ((HsBindgen.Runtime.HasCField.CFieldType BTree_Tag) "unwrap")
) => GHC.Records.HasField "unwrap" (Ptr.Ptr BTree_Tag) (Ptr.Ptr ty) where
getField =
HsBindgen.Runtime.HasCField.fromPtr (Data.Proxy.Proxy @"unwrap")
instance HsBindgen.Runtime.HasCField.HasCField BTree_Tag "unwrap" where
type CFieldType BTree_Tag "unwrap" = FC.CUInt
offset# = \_ -> \_ -> 0
{-| __C declaration:__ @Leaf@
__defined at:__ @garnet_rs.h 34:3@
__exported by:__ @garnet_rs.h@
-}
pattern Leaf :: BTree_Tag
pattern Leaf = BTree_Tag 0
{-| __C declaration:__ @Fork@
__defined at:__ @garnet_rs.h 35:3@
__exported by:__ @garnet_rs.h@
-}
pattern Fork :: BTree_Tag
pattern Fork = BTree_Tag 1
{-| __C declaration:__ @struct Leaf_Body@
__defined at:__ @garnet_rs.h 38:8@
__exported by:__ @garnet_rs.h@
-}
data Leaf_Body = Leaf_Body
{ value :: HsBindgen.Runtime.LibC.Int64
{- ^ __C declaration:__ @value@
__defined at:__ @garnet_rs.h 39:11@
__exported by:__ @garnet_rs.h@
-}
}
deriving stock (GHC.Generics.Generic)
deriving stock (Eq, Show)
instance HsBindgen.Runtime.Marshal.StaticSize Leaf_Body where
staticSizeOf = \_ -> (8 :: Int)
staticAlignment = \_ -> (8 :: Int)
instance HsBindgen.Runtime.Marshal.ReadRaw Leaf_Body where
readRaw =
\ptr0 ->
pure Leaf_Body
<*> HsBindgen.Runtime.HasCField.readRaw (Data.Proxy.Proxy @"value") ptr0
instance HsBindgen.Runtime.Marshal.WriteRaw Leaf_Body where
writeRaw =
\ptr0 ->
\s1 ->
case s1 of
Leaf_Body value2 ->
HsBindgen.Runtime.HasCField.writeRaw (Data.Proxy.Proxy @"value") ptr0 value2
deriving via HsBindgen.Runtime.Marshal.EquivStorable Leaf_Body instance F.Storable Leaf_Body
instance HsBindgen.Runtime.HasCField.HasCField Leaf_Body "value" where
type CFieldType Leaf_Body "value" =
HsBindgen.Runtime.LibC.Int64
offset# = \_ -> \_ -> 0
instance ( TyEq ty ((HsBindgen.Runtime.HasCField.CFieldType Leaf_Body) "value")
) => GHC.Records.HasField "value" (Ptr.Ptr Leaf_Body) (Ptr.Ptr ty) where
getField =
HsBindgen.Runtime.HasCField.fromPtr (Data.Proxy.Proxy @"value")
{-| __C declaration:__ @struct Fork_Body@
__defined at:__ @garnet_rs.h 42:8@
__exported by:__ @garnet_rs.h@
-}
data Fork_Body = Fork_Body
{ left :: HsBindgen.Runtime.PtrConst.PtrConst BTree
{- ^ __C declaration:__ @left@
__defined at:__ @garnet_rs.h 43:23@
__exported by:__ @garnet_rs.h@
-}
, right :: HsBindgen.Runtime.PtrConst.PtrConst BTree
{- ^ __C declaration:__ @right@
__defined at:__ @garnet_rs.h 44:23@
__exported by:__ @garnet_rs.h@
-}
}
deriving stock (GHC.Generics.Generic)
deriving stock (Eq, Show)
instance HsBindgen.Runtime.Marshal.StaticSize Fork_Body where
staticSizeOf = \_ -> (16 :: Int)
staticAlignment = \_ -> (8 :: Int)
instance HsBindgen.Runtime.Marshal.ReadRaw Fork_Body where
readRaw =
\ptr0 ->
pure Fork_Body
<*> HsBindgen.Runtime.HasCField.readRaw (Data.Proxy.Proxy @"left") ptr0
<*> HsBindgen.Runtime.HasCField.readRaw (Data.Proxy.Proxy @"right") ptr0
instance HsBindgen.Runtime.Marshal.WriteRaw Fork_Body where
writeRaw =
\ptr0 ->
\s1 ->
case s1 of
Fork_Body left2 right3 ->
HsBindgen.Runtime.HasCField.writeRaw (Data.Proxy.Proxy @"left") ptr0 left2
>> HsBindgen.Runtime.HasCField.writeRaw (Data.Proxy.Proxy @"right") ptr0 right3
deriving via HsBindgen.Runtime.Marshal.EquivStorable Fork_Body instance F.Storable Fork_Body
instance HsBindgen.Runtime.HasCField.HasCField Fork_Body "left" where
type CFieldType Fork_Body "left" =
HsBindgen.Runtime.PtrConst.PtrConst BTree
offset# = \_ -> \_ -> 0
instance ( TyEq ty ((HsBindgen.Runtime.HasCField.CFieldType Fork_Body) "left")
) => GHC.Records.HasField "left" (Ptr.Ptr Fork_Body) (Ptr.Ptr ty) where
getField =
HsBindgen.Runtime.HasCField.fromPtr (Data.Proxy.Proxy @"left")
instance HsBindgen.Runtime.HasCField.HasCField Fork_Body "right" where
type CFieldType Fork_Body "right" =
HsBindgen.Runtime.PtrConst.PtrConst BTree
offset# = \_ -> \_ -> 8
instance ( TyEq ty ((HsBindgen.Runtime.HasCField.CFieldType Fork_Body) "right")
) => GHC.Records.HasField "right" (Ptr.Ptr Fork_Body) (Ptr.Ptr ty) where
getField =
HsBindgen.Runtime.HasCField.fromPtr (Data.Proxy.Proxy @"right")
{-| __C declaration:__ @union \@BTree_body@
__defined at:__ @garnet_rs.h 49:3@
__exported by:__ @garnet_rs.h@
-}
newtype BTree_body = BTree_body
{ unwrap :: Data.Array.Byte.ByteArray
}
deriving stock (GHC.Generics.Generic)
deriving via (HsBindgen.Runtime.Internal.SizedByteArray.SizedByteArray 16) 8 instance HsBindgen.Runtime.Marshal.StaticSize BTree_body
deriving via (HsBindgen.Runtime.Internal.SizedByteArray.SizedByteArray 16) 8 instance HsBindgen.Runtime.Marshal.ReadRaw BTree_body
deriving via (HsBindgen.Runtime.Internal.SizedByteArray.SizedByteArray 16) 8 instance HsBindgen.Runtime.Marshal.WriteRaw BTree_body
deriving via HsBindgen.Runtime.Marshal.EquivStorable BTree_body instance F.Storable BTree_body
{-|
__See:__ 'set_bTree_body_leaf'
__C declaration:__ @leaf@
__defined at:__ @garnet_rs.h 50:22@
__exported by:__ @garnet_rs.h@
-}
get_bTree_body_leaf ::
BTree_body
-> Leaf_Body
get_bTree_body_leaf =
HsBindgen.Runtime.Internal.ByteArray.getUnionPayload
{-|
__See:__ 'get_bTree_body_leaf'
-}
set_bTree_body_leaf ::
Leaf_Body
-> BTree_body
set_bTree_body_leaf =
HsBindgen.Runtime.Internal.ByteArray.setUnionPayload
{-|
__See:__ 'set_bTree_body_fork'
__C declaration:__ @fork@
__defined at:__ @garnet_rs.h 51:22@
__exported by:__ @garnet_rs.h@
-}
get_bTree_body_fork ::
BTree_body
-> Fork_Body
get_bTree_body_fork =
HsBindgen.Runtime.Internal.ByteArray.getUnionPayload
{-|
__See:__ 'get_bTree_body_fork'
-}
set_bTree_body_fork ::
Fork_Body
-> BTree_body
set_bTree_body_fork =
HsBindgen.Runtime.Internal.ByteArray.setUnionPayload
instance HsBindgen.Runtime.HasCField.HasCField BTree_body "leaf" where
type CFieldType BTree_body "leaf" = Leaf_Body
offset# = \_ -> \_ -> 0
instance ( TyEq ty ((HsBindgen.Runtime.HasCField.CFieldType BTree_body) "leaf")
) => GHC.Records.HasField "leaf" (Ptr.Ptr BTree_body) (Ptr.Ptr ty) where
getField =
HsBindgen.Runtime.HasCField.fromPtr (Data.Proxy.Proxy @"leaf")
instance HsBindgen.Runtime.HasCField.HasCField BTree_body "fork" where
type CFieldType BTree_body "fork" = Fork_Body
offset# = \_ -> \_ -> 0
instance ( TyEq ty ((HsBindgen.Runtime.HasCField.CFieldType BTree_body) "fork")
) => GHC.Records.HasField "fork" (Ptr.Ptr BTree_body) (Ptr.Ptr ty) where
getField =
HsBindgen.Runtime.HasCField.fromPtr (Data.Proxy.Proxy @"fork")
{-| __C declaration:__ @struct BTree@
__defined at:__ @garnet_rs.h 47:8@
__exported by:__ @garnet_rs.h@
-}
data BTree = BTree
{ tag :: BTree_Tag
{- ^ __C declaration:__ @tag@
__defined at:__ @garnet_rs.h 48:18@
__exported by:__ @garnet_rs.h@
-}
, body :: BTree_body
{- ^ __C declaration:__ @body@
__defined at:__ @garnet_rs.h 52:5@
__exported by:__ @garnet_rs.h@
-}
}
deriving stock (GHC.Generics.Generic)
instance HsBindgen.Runtime.Marshal.StaticSize BTree where
staticSizeOf = \_ -> (24 :: Int)
staticAlignment = \_ -> (8 :: Int)
instance HsBindgen.Runtime.Marshal.ReadRaw BTree where
readRaw =
\ptr0 ->
pure BTree
<*> HsBindgen.Runtime.HasCField.readRaw (Data.Proxy.Proxy @"tag") ptr0
<*> HsBindgen.Runtime.HasCField.readRaw (Data.Proxy.Proxy @"body") ptr0
instance HsBindgen.Runtime.Marshal.WriteRaw BTree where
writeRaw =
\ptr0 ->
\s1 ->
case s1 of
BTree tag2 body3 ->
HsBindgen.Runtime.HasCField.writeRaw (Data.Proxy.Proxy @"tag") ptr0 tag2
>> HsBindgen.Runtime.HasCField.writeRaw (Data.Proxy.Proxy @"body") ptr0 body3
deriving via HsBindgen.Runtime.Marshal.EquivStorable BTree instance F.Storable BTree
instance HsBindgen.Runtime.HasCField.HasCField BTree "tag" where
type CFieldType BTree "tag" = BTree_Tag
offset# = \_ -> \_ -> 0
instance ( TyEq ty ((HsBindgen.Runtime.HasCField.CFieldType BTree) "tag")
) => GHC.Records.HasField "tag" (Ptr.Ptr BTree) (Ptr.Ptr ty) where
getField =
HsBindgen.Runtime.HasCField.fromPtr (Data.Proxy.Proxy @"tag")
instance HsBindgen.Runtime.HasCField.HasCField BTree "body" where
type CFieldType BTree "body" = BTree_body
offset# = \_ -> \_ -> 8
instance ( TyEq ty ((HsBindgen.Runtime.HasCField.CFieldType BTree) "body")
) => GHC.Records.HasField "body" (Ptr.Ptr BTree) (Ptr.Ptr ty) where
getField =
HsBindgen.Runtime.HasCField.fromPtr (Data.Proxy.Proxy @"body")